mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-07-01 12:32:09 +00:00
8 / check mem usage (#10)
* 8 / Check Mem Job * 8 / check mem usage - localization
This commit is contained in:
parent
07ffa7a525
commit
876045a123
18 changed files with 138 additions and 5 deletions
|
@ -22,6 +22,8 @@ class AllSetting {
|
||||||
this.tgBotBackup = false;
|
this.tgBotBackup = false;
|
||||||
this.tgBotLoginNotify = true;
|
this.tgBotLoginNotify = true;
|
||||||
this.tgCpu = 80;
|
this.tgCpu = 80;
|
||||||
|
this.tgMem = 80;
|
||||||
|
this.restartAtMemThreshold = false;
|
||||||
this.tgLang = "en-US";
|
this.tgLang = "en-US";
|
||||||
this.xrayTemplateConfig = "";
|
this.xrayTemplateConfig = "";
|
||||||
this.secretEnable = false;
|
this.secretEnable = false;
|
||||||
|
@ -43,7 +45,7 @@ class AllSetting {
|
||||||
this.subJsonMux = "";
|
this.subJsonMux = "";
|
||||||
this.subJsonRules = "";
|
this.subJsonRules = "";
|
||||||
|
|
||||||
this.timeLocation = "Asia/Tehran";
|
this.timeLocation = "Europe/Moscow";
|
||||||
|
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
return
|
return
|
||||||
|
|
|
@ -36,6 +36,8 @@ type AllSetting struct {
|
||||||
TgBotBackup bool `json:"tgBotBackup" form:"tgBotBackup"`
|
TgBotBackup bool `json:"tgBotBackup" form:"tgBotBackup"`
|
||||||
TgBotLoginNotify bool `json:"tgBotLoginNotify" form:"tgBotLoginNotify"`
|
TgBotLoginNotify bool `json:"tgBotLoginNotify" form:"tgBotLoginNotify"`
|
||||||
TgCpu int `json:"tgCpu" form:"tgCpu"`
|
TgCpu int `json:"tgCpu" form:"tgCpu"`
|
||||||
|
TgMem int `json:"tgMem" form:"tgMem"`
|
||||||
|
RestartAtMemThreshold bool `json:"restartAtMemThreshold" form:"restartAtMemThreshold"`
|
||||||
TgLang string `json:"tgLang" form:"tgLang"`
|
TgLang string `json:"tgLang" form:"tgLang"`
|
||||||
TimeLocation string `json:"timeLocation" form:"timeLocation"`
|
TimeLocation string `json:"timeLocation" form:"timeLocation"`
|
||||||
SecretEnable bool `json:"secretEnable" form:"secretEnable"`
|
SecretEnable bool `json:"secretEnable" form:"secretEnable"`
|
||||||
|
@ -100,6 +102,10 @@ func (s *AllSetting) CheckValid() error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if s.TgMem < 0 || s.TgMem > 100 {
|
||||||
|
return common.NewError("TgMem must be in the range 0-100, passed ", s.TgMem)
|
||||||
|
}
|
||||||
|
|
||||||
if !strings.HasPrefix(s.WebBasePath, "/") {
|
if !strings.HasPrefix(s.WebBasePath, "/") {
|
||||||
s.WebBasePath = "/" + s.WebBasePath
|
s.WebBasePath = "/" + s.WebBasePath
|
||||||
}
|
}
|
||||||
|
|
|
@ -245,6 +245,8 @@
|
||||||
<setting-list-item type="switch" title='{{ i18n "pages.settings.tgNotifyBackup" }}' desc='{{ i18n "pages.settings.tgNotifyBackupDesc" }}' v-model="allSetting.tgBotBackup"></setting-list-item>
|
<setting-list-item type="switch" title='{{ i18n "pages.settings.tgNotifyBackup" }}' desc='{{ i18n "pages.settings.tgNotifyBackupDesc" }}' v-model="allSetting.tgBotBackup"></setting-list-item>
|
||||||
<setting-list-item type="switch" title='{{ i18n "pages.settings.tgNotifyLogin" }}' desc='{{ i18n "pages.settings.tgNotifyLoginDesc" }}' v-model="allSetting.tgBotLoginNotify"></setting-list-item>
|
<setting-list-item type="switch" title='{{ i18n "pages.settings.tgNotifyLogin" }}' desc='{{ i18n "pages.settings.tgNotifyLoginDesc" }}' v-model="allSetting.tgBotLoginNotify"></setting-list-item>
|
||||||
<setting-list-item type="number" title='{{ i18n "pages.settings.tgNotifyCpu" }}' desc='{{ i18n "pages.settings.tgNotifyCpuDesc" }}' v-model="allSetting.tgCpu" :min="0" :max="100"></setting-list-item>
|
<setting-list-item type="number" title='{{ i18n "pages.settings.tgNotifyCpu" }}' desc='{{ i18n "pages.settings.tgNotifyCpuDesc" }}' v-model="allSetting.tgCpu" :min="0" :max="100"></setting-list-item>
|
||||||
|
<setting-list-item type="number" title='{{ i18n "pages.settings.tgNotifyMem" }}' desc='{{ i18n "pages.settings.tgNotifyMemDesc" }}' v-model="allSetting.tgMem" :min="0" :max="100"></setting-list-item>
|
||||||
|
<setting-list-item type="switch" title='{{ i18n "pages.settings.restartAtMemThreshold" }}' desc='{{ i18n "pages.settings.restartAtMemThresholdDesc" }}' v-model="allSetting.restartAtMemThreshold"></setting-list-item>
|
||||||
<setting-list-item type="text" title='{{ i18n "pages.settings.telegramProxy"}}' desc='{{ i18n "pages.settings.telegramProxyDesc"}}' v-model="allSetting.tgBotProxy" placeholder="socks5://user:pass@host:port"></setting-list-item>
|
<setting-list-item type="text" title='{{ i18n "pages.settings.telegramProxy"}}' desc='{{ i18n "pages.settings.telegramProxyDesc"}}' v-model="allSetting.tgBotProxy" placeholder="socks5://user:pass@host:port"></setting-list-item>
|
||||||
<setting-list-item type="text" title='{{ i18n "pages.settings.telegramAPIServer"}}' desc='{{ i18n "pages.settings.telegramAPIServerDesc"}}' v-model="allSetting.tgBotAPIServer" placeholder="https://api.example.com"></setting-list-item>
|
<setting-list-item type="text" title='{{ i18n "pages.settings.telegramAPIServer"}}' desc='{{ i18n "pages.settings.telegramAPIServerDesc"}}' v-model="allSetting.tgBotAPIServer" placeholder="https://api.example.com"></setting-list-item>
|
||||||
<a-list-item>
|
<a-list-item>
|
||||||
|
@ -464,7 +466,7 @@
|
||||||
type: "field",
|
type: "field",
|
||||||
outboundTag: "direct",
|
outboundTag: "direct",
|
||||||
domain: [
|
domain: [
|
||||||
"geosite:category-ir"
|
"geosite:category-ru"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -472,7 +474,7 @@
|
||||||
outboundTag: "direct",
|
outboundTag: "direct",
|
||||||
ip: [
|
ip: [
|
||||||
"geoip:private",
|
"geoip:private",
|
||||||
"geoip:ir"
|
"geoip:ru"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -824,7 +826,7 @@
|
||||||
subJsonPath = this.allSetting.subJsonURI.length > 0 ? new URL(this.allSetting.subJsonURI).pathname : this.allSetting.subJsonPath;
|
subJsonPath = this.allSetting.subJsonURI.length > 0 ? new URL(this.allSetting.subJsonURI).pathname : this.allSetting.subJsonPath;
|
||||||
if (subJsonPath == '/json/') alerts.push('{{ i18n "secAlertSubJsonURI" }}');
|
if (subJsonPath == '/json/') alerts.push('{{ i18n "secAlertSubJsonURI" }}');
|
||||||
}
|
}
|
||||||
return alerts
|
return alerts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
47
web/job/check_mem_usage.go
Normal file
47
web/job/check_mem_usage.go
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
package job
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"x-ui/web/service"
|
||||||
|
"x-ui/logger"
|
||||||
|
|
||||||
|
"github.com/shirou/gopsutil/v4/mem"
|
||||||
|
)
|
||||||
|
|
||||||
|
type CheckMemJob struct {
|
||||||
|
tgbotService service.Tgbot
|
||||||
|
settingService service.SettingService
|
||||||
|
serverService service.ServerService
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewCheckMemJob() *CheckMemJob {
|
||||||
|
return new(CheckMemJob)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Here run is a interface method of Job interface
|
||||||
|
func (j *CheckMemJob) Run() {
|
||||||
|
threshold, _ := j.settingService.GetTgMem()
|
||||||
|
needRestart, _ := j.settingService.GetRestartAtMemThreshold()
|
||||||
|
|
||||||
|
memInfo, err := mem.VirtualMemory()
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("CheckMemJob -- get virtual memory failed:", err)
|
||||||
|
} else {
|
||||||
|
currentMem := memInfo.Used
|
||||||
|
totalMem := memInfo.Total
|
||||||
|
percentMem := int(currentMem / totalMem * 100)
|
||||||
|
|
||||||
|
if percentMem >= int(threshold) && bool(needRestart) == true {
|
||||||
|
msg := j.tgbotService.I18nBot("tgbot.messages.memThreshold", "Threshold=="+strconv.Itoa(threshold))
|
||||||
|
j.tgbotService.SendMsgToTgbotAdmins(msg)
|
||||||
|
|
||||||
|
err := j.serverService.RestartXrayService()
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("CheckMemJob -- RestartXrayService failed:", err)
|
||||||
|
} else {
|
||||||
|
logger.Info("CheckMemJob -- RestartXrayService success")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -37,7 +37,7 @@ var defaultValueMap = map[string]string{
|
||||||
"expireDiff": "0",
|
"expireDiff": "0",
|
||||||
"trafficDiff": "0",
|
"trafficDiff": "0",
|
||||||
"remarkModel": "-ieo",
|
"remarkModel": "-ieo",
|
||||||
"timeLocation": "Asia/Tehran",
|
"timeLocation": "Europe/Moscow",
|
||||||
"tgBotEnable": "false",
|
"tgBotEnable": "false",
|
||||||
"tgBotToken": "",
|
"tgBotToken": "",
|
||||||
"tgBotProxy": "",
|
"tgBotProxy": "",
|
||||||
|
@ -47,6 +47,8 @@ var defaultValueMap = map[string]string{
|
||||||
"tgBotBackup": "false",
|
"tgBotBackup": "false",
|
||||||
"tgBotLoginNotify": "true",
|
"tgBotLoginNotify": "true",
|
||||||
"tgCpu": "80",
|
"tgCpu": "80",
|
||||||
|
"tgMem": "80",
|
||||||
|
"restartAtMemThreshold":"false",
|
||||||
"tgLang": "en-US",
|
"tgLang": "en-US",
|
||||||
"secretEnable": "false",
|
"secretEnable": "false",
|
||||||
"subEnable": "false",
|
"subEnable": "false",
|
||||||
|
@ -311,6 +313,14 @@ func (s *SettingService) GetTgCpu() (int, error) {
|
||||||
return s.getInt("tgCpu")
|
return s.getInt("tgCpu")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *SettingService) GetTgMem() (int, error) {
|
||||||
|
return s.getInt("tgMem")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *SettingService) GetRestartAtMemThreshold() (bool, error) {
|
||||||
|
return s.getBool("restartAtMemThreshold")
|
||||||
|
}
|
||||||
|
|
||||||
func (s *SettingService) GetTgLang() (string, error) {
|
func (s *SettingService) GetTgLang() (string, error) {
|
||||||
return s.getString("tgLang")
|
return s.getString("tgLang")
|
||||||
}
|
}
|
||||||
|
|
|
@ -282,6 +282,10 @@
|
||||||
"trafficDiffDesc" = "Get notified about traffic cap when reaching this threshold. (unit: GB)"
|
"trafficDiffDesc" = "Get notified about traffic cap when reaching this threshold. (unit: GB)"
|
||||||
"tgNotifyCpu" = "CPU Load Notification"
|
"tgNotifyCpu" = "CPU Load Notification"
|
||||||
"tgNotifyCpuDesc" = "Get notified if CPU load exceeds this threshold. (unit: %)"
|
"tgNotifyCpuDesc" = "Get notified if CPU load exceeds this threshold. (unit: %)"
|
||||||
|
"tgNotifyMem" = "RAM Load Notification"
|
||||||
|
"tgNotifyMemDesc" = "Get notified if RAM load exceeds this threshold. (unit: %)"
|
||||||
|
"restartAtMemThreshold" = "Restart Xray when the threshold is reached"
|
||||||
|
"restartAtMemThresholdDesc" = "When the RAM utilization reaches the specified percentage, Xray will be restarted"
|
||||||
"timeZone" = "Time Zone"
|
"timeZone" = "Time Zone"
|
||||||
"timeZoneDesc" = "Scheduled tasks will run based on this time zone."
|
"timeZoneDesc" = "Scheduled tasks will run based on this time zone."
|
||||||
"subSettings" = "Subscription"
|
"subSettings" = "Subscription"
|
||||||
|
@ -493,6 +497,7 @@
|
||||||
|
|
||||||
[tgbot.messages]
|
[tgbot.messages]
|
||||||
"cpuThreshold" = "🔴 CPU Load {{ .Percent }}% exceeds the threshold of {{ .Threshold }}%"
|
"cpuThreshold" = "🔴 CPU Load {{ .Percent }}% exceeds the threshold of {{ .Threshold }}%"
|
||||||
|
"memThreshold" = "🔴 RAM Threshold\r\nThe {{ .Threshold }}% threshold has been reached. Reboot performed"
|
||||||
"selectUserFailed" = "❌ Error in user selection!"
|
"selectUserFailed" = "❌ Error in user selection!"
|
||||||
"userSaved" = "✅ Telegram User saved."
|
"userSaved" = "✅ Telegram User saved."
|
||||||
"loginSuccess" = "✅ Logged in to the panel successfully.\r\n"
|
"loginSuccess" = "✅ Logged in to the panel successfully.\r\n"
|
||||||
|
|
|
@ -282,6 +282,10 @@
|
||||||
"trafficDiffDesc" = "Reciba notificaciones sobre el agotamiento del tráfico antes de alcanzar el umbral (unidad: GB)."
|
"trafficDiffDesc" = "Reciba notificaciones sobre el agotamiento del tráfico antes de alcanzar el umbral (unidad: GB)."
|
||||||
"tgNotifyCpu" = "Umbral de Alerta de Porcentaje de CPU"
|
"tgNotifyCpu" = "Umbral de Alerta de Porcentaje de CPU"
|
||||||
"tgNotifyCpuDesc" = "Reciba notificaciones si el uso de la CPU supera este umbral (unidad: %)."
|
"tgNotifyCpuDesc" = "Reciba notificaciones si el uso de la CPU supera este umbral (unidad: %)."
|
||||||
|
"tgNotifyMem" = "RAM Load Notification"
|
||||||
|
"tgNotifyMemDesc" = "Get notified if RAM load exceeds this threshold. (unit: %)"
|
||||||
|
"restartAtMemThreshold" = "Restart Xray when the threshold is reached"
|
||||||
|
"restartAtMemThresholdDesc" = "When the RAM utilization reaches the specified percentage, Xray will be restarted"
|
||||||
"timeZone" = "Zona Horaria"
|
"timeZone" = "Zona Horaria"
|
||||||
"timeZoneDesc" = "Las tareas programadas se ejecutan de acuerdo con la hora en esta zona horaria."
|
"timeZoneDesc" = "Las tareas programadas se ejecutan de acuerdo con la hora en esta zona horaria."
|
||||||
"subSettings" = "Suscripción"
|
"subSettings" = "Suscripción"
|
||||||
|
@ -493,6 +497,7 @@
|
||||||
|
|
||||||
[tgbot.messages]
|
[tgbot.messages]
|
||||||
"cpuThreshold" = "🔴 El uso de CPU {{ .Percent }}% es mayor que el umbral {{ .Threshold }}%"
|
"cpuThreshold" = "🔴 El uso de CPU {{ .Percent }}% es mayor que el umbral {{ .Threshold }}%"
|
||||||
|
"memThreshold" = "🔴 RAM Threshold\r\nThe {{ .Threshold }}% threshold has been reached. Reboot performed"
|
||||||
"selectUserFailed" = "❌ ¡Error al seleccionar usuario!"
|
"selectUserFailed" = "❌ ¡Error al seleccionar usuario!"
|
||||||
"userSaved" = "✅ Usuario de Telegram guardado."
|
"userSaved" = "✅ Usuario de Telegram guardado."
|
||||||
"loginSuccess" = "✅ Has iniciado sesión en el panel con éxito.\r\n"
|
"loginSuccess" = "✅ Has iniciado sesión en el panel con éxito.\r\n"
|
||||||
|
|
|
@ -282,6 +282,10 @@
|
||||||
"trafficDiffDesc" = "(فاصله زمانی هشدار تا رسیدن به اتمام ترافیک. (واحد: گیگابایت"
|
"trafficDiffDesc" = "(فاصله زمانی هشدار تا رسیدن به اتمام ترافیک. (واحد: گیگابایت"
|
||||||
"tgNotifyCpu" = "آستانه هشدار بار پردازنده"
|
"tgNotifyCpu" = "آستانه هشدار بار پردازنده"
|
||||||
"tgNotifyCpuDesc" = "(اگر بار روی پردازنده ازاین آستانه فراتر رفت، برای شما پیام ارسال میشود. (واحد: درصد"
|
"tgNotifyCpuDesc" = "(اگر بار روی پردازنده ازاین آستانه فراتر رفت، برای شما پیام ارسال میشود. (واحد: درصد"
|
||||||
|
"tgNotifyMem" = "RAM Load Notification"
|
||||||
|
"tgNotifyMemDesc" = "Get notified if RAM load exceeds this threshold. (unit: %)"
|
||||||
|
"restartAtMemThreshold" = "Restart Xray when the threshold is reached"
|
||||||
|
"restartAtMemThresholdDesc" = "When the RAM utilization reaches the specified percentage, Xray will be restarted"
|
||||||
"timeZone" = "منطقه زمانی"
|
"timeZone" = "منطقه زمانی"
|
||||||
"timeZoneDesc" = "وظایف برنامه ریزی شده بر اساس این منطقهزمانی اجرا میشود"
|
"timeZoneDesc" = "وظایف برنامه ریزی شده بر اساس این منطقهزمانی اجرا میشود"
|
||||||
"subSettings" = "سابسکریپشن"
|
"subSettings" = "سابسکریپشن"
|
||||||
|
@ -493,6 +497,7 @@
|
||||||
|
|
||||||
[tgbot.messages]
|
[tgbot.messages]
|
||||||
"cpuThreshold" = "🔴 بار پردازنده {{ .Percent }}% بیشتر از آستانه است {{ .Threshold }}%"
|
"cpuThreshold" = "🔴 بار پردازنده {{ .Percent }}% بیشتر از آستانه است {{ .Threshold }}%"
|
||||||
|
"memThreshold" = "🔴 RAM Threshold\r\nThe {{ .Threshold }}% threshold has been reached. Reboot performed"
|
||||||
"selectUserFailed" = "❌ خطا در انتخاب کاربر!"
|
"selectUserFailed" = "❌ خطا در انتخاب کاربر!"
|
||||||
"userSaved" = "✅ کاربر تلگرام ذخیره شد."
|
"userSaved" = "✅ کاربر تلگرام ذخیره شد."
|
||||||
"loginSuccess" = "✅ با موفقیت به پنل وارد شدید.\r\n"
|
"loginSuccess" = "✅ با موفقیت به پنل وارد شدید.\r\n"
|
||||||
|
|
|
@ -282,6 +282,10 @@
|
||||||
"trafficDiffDesc" = "Dapatkan notifikasi tentang batas traffic saat mencapai ambang batas ini. (unit: GB)"
|
"trafficDiffDesc" = "Dapatkan notifikasi tentang batas traffic saat mencapai ambang batas ini. (unit: GB)"
|
||||||
"tgNotifyCpu" = "Notifikasi Beban CPU"
|
"tgNotifyCpu" = "Notifikasi Beban CPU"
|
||||||
"tgNotifyCpuDesc" = "Dapatkan notifikasi jika beban CPU melebihi ambang batas ini. (unit: %)"
|
"tgNotifyCpuDesc" = "Dapatkan notifikasi jika beban CPU melebihi ambang batas ini. (unit: %)"
|
||||||
|
"tgNotifyMem" = "RAM Load Notification"
|
||||||
|
"tgNotifyMemDesc" = "Get notified if RAM load exceeds this threshold. (unit: %)"
|
||||||
|
"restartAtMemThreshold" = "Restart Xray when the threshold is reached"
|
||||||
|
"restartAtMemThresholdDesc" = "When the RAM utilization reaches the specified percentage, Xray will be restarted"
|
||||||
"timeZone" = "Zone Waktu"
|
"timeZone" = "Zone Waktu"
|
||||||
"timeZoneDesc" = "Tugas terjadwal akan berjalan berdasarkan zona waktu ini."
|
"timeZoneDesc" = "Tugas terjadwal akan berjalan berdasarkan zona waktu ini."
|
||||||
"subSettings" = "Langganan"
|
"subSettings" = "Langganan"
|
||||||
|
@ -493,6 +497,7 @@
|
||||||
|
|
||||||
[tgbot.messages]
|
[tgbot.messages]
|
||||||
"cpuThreshold" = "🔴 Beban CPU {{ .Percent }}% melebihi batas {{ .Threshold }}%"
|
"cpuThreshold" = "🔴 Beban CPU {{ .Percent }}% melebihi batas {{ .Threshold }}%"
|
||||||
|
"memThreshold" = "🔴 RAM Threshold\r\nThe {{ .Threshold }}% threshold has been reached. Reboot performed"
|
||||||
"selectUserFailed" = "❌ Kesalahan dalam pemilihan pengguna!"
|
"selectUserFailed" = "❌ Kesalahan dalam pemilihan pengguna!"
|
||||||
"userSaved" = "✅ Pengguna Telegram tersimpan."
|
"userSaved" = "✅ Pengguna Telegram tersimpan."
|
||||||
"loginSuccess" = "✅ Berhasil masuk ke panel.\r\n"
|
"loginSuccess" = "✅ Berhasil masuk ke panel.\r\n"
|
||||||
|
|
|
@ -282,6 +282,10 @@
|
||||||
"trafficDiffDesc" = "このしきい値に達した場合、トラフィック消耗に関する通知を受け取る(単位:GB)"
|
"trafficDiffDesc" = "このしきい値に達した場合、トラフィック消耗に関する通知を受け取る(単位:GB)"
|
||||||
"tgNotifyCpu" = "CPU負荷通知しきい値"
|
"tgNotifyCpu" = "CPU負荷通知しきい値"
|
||||||
"tgNotifyCpuDesc" = "CPU負荷がこのしきい値を超えた場合、通知を受け取る(単位:%)"
|
"tgNotifyCpuDesc" = "CPU負荷がこのしきい値を超えた場合、通知を受け取る(単位:%)"
|
||||||
|
"tgNotifyMem" = "RAM Load Notification"
|
||||||
|
"tgNotifyMemDesc" = "Get notified if RAM load exceeds this threshold. (unit: %)"
|
||||||
|
"restartAtMemThreshold" = "Restart Xray when the threshold is reached"
|
||||||
|
"restartAtMemThresholdDesc" = "When the RAM utilization reaches the specified percentage, Xray will be restarted"
|
||||||
"timeZone" = "タイムゾーン"
|
"timeZone" = "タイムゾーン"
|
||||||
"timeZoneDesc" = "定時タスクはこのタイムゾーンの時間に従って実行される"
|
"timeZoneDesc" = "定時タスクはこのタイムゾーンの時間に従って実行される"
|
||||||
"subSettings" = "サブスクリプション設定"
|
"subSettings" = "サブスクリプション設定"
|
||||||
|
@ -493,6 +497,7 @@
|
||||||
|
|
||||||
[tgbot.messages]
|
[tgbot.messages]
|
||||||
"cpuThreshold" = "🔴 CPU使用率は{{ .Percent }}%、しきい値{{ .Threshold }}%を超えました"
|
"cpuThreshold" = "🔴 CPU使用率は{{ .Percent }}%、しきい値{{ .Threshold }}%を超えました"
|
||||||
|
"memThreshold" = "🔴 RAM Threshold\r\nThe {{ .Threshold }}% threshold has been reached. Reboot performed"
|
||||||
"selectUserFailed" = "❌ ユーザーの選択に失敗しました!"
|
"selectUserFailed" = "❌ ユーザーの選択に失敗しました!"
|
||||||
"userSaved" = "✅ Telegramユーザーが保存されました。"
|
"userSaved" = "✅ Telegramユーザーが保存されました。"
|
||||||
"loginSuccess" = "✅ パネルに正常にログインしました。\r\n"
|
"loginSuccess" = "✅ パネルに正常にログインしました。\r\n"
|
||||||
|
|
|
@ -282,6 +282,10 @@
|
||||||
"trafficDiffDesc" = "Receba notificações sobre o limite de tráfego ao atingir esse limite. (unidade: GB)"
|
"trafficDiffDesc" = "Receba notificações sobre o limite de tráfego ao atingir esse limite. (unidade: GB)"
|
||||||
"tgNotifyCpu" = "Notificação de Carga da CPU"
|
"tgNotifyCpu" = "Notificação de Carga da CPU"
|
||||||
"tgNotifyCpuDesc" = "Receba notificações se a carga da CPU ultrapassar esse limite. (unidade: %)"
|
"tgNotifyCpuDesc" = "Receba notificações se a carga da CPU ultrapassar esse limite. (unidade: %)"
|
||||||
|
"tgNotifyMem" = "RAM Load Notification"
|
||||||
|
"tgNotifyMemDesc" = "Get notified if RAM load exceeds this threshold. (unit: %)"
|
||||||
|
"restartAtMemThreshold" = "Restart Xray when the threshold is reached"
|
||||||
|
"restartAtMemThresholdDesc" = "When the RAM utilization reaches the specified percentage, Xray will be restarted"
|
||||||
"timeZone" = "Fuso Horário"
|
"timeZone" = "Fuso Horário"
|
||||||
"timeZoneDesc" = "As tarefas agendadas serão executadas com base nesse fuso horário."
|
"timeZoneDesc" = "As tarefas agendadas serão executadas com base nesse fuso horário."
|
||||||
"subSettings" = "Assinatura"
|
"subSettings" = "Assinatura"
|
||||||
|
@ -493,6 +497,7 @@
|
||||||
|
|
||||||
[tgbot.messages]
|
[tgbot.messages]
|
||||||
"cpuThreshold" = "🔴 A carga da CPU {{ .Percent }}% excede o limite de {{ .Threshold }}%"
|
"cpuThreshold" = "🔴 A carga da CPU {{ .Percent }}% excede o limite de {{ .Threshold }}%"
|
||||||
|
"memThreshold" = "🔴 RAM Threshold\r\nThe {{ .Threshold }}% threshold has been reached. Reboot performed"
|
||||||
"selectUserFailed" = "❌ Erro na seleção do usuário!"
|
"selectUserFailed" = "❌ Erro na seleção do usuário!"
|
||||||
"userSaved" = "✅ Usuário do Telegram salvo."
|
"userSaved" = "✅ Usuário do Telegram salvo."
|
||||||
"loginSuccess" = "✅ Conectado ao painel com sucesso.\r\n"
|
"loginSuccess" = "✅ Conectado ao painel com sucesso.\r\n"
|
||||||
|
|
|
@ -282,6 +282,10 @@
|
||||||
"trafficDiffDesc" = "Получение уведомления об исчерпании трафика до достижения порога (значение: ГБ)"
|
"trafficDiffDesc" = "Получение уведомления об исчерпании трафика до достижения порога (значение: ГБ)"
|
||||||
"tgNotifyCpu" = "Порог нагрузки на ЦП для уведомления"
|
"tgNotifyCpu" = "Порог нагрузки на ЦП для уведомления"
|
||||||
"tgNotifyCpuDesc" = "Получение уведомления, если нагрузка на ЦП превышает этот порог (значение: %)"
|
"tgNotifyCpuDesc" = "Получение уведомления, если нагрузка на ЦП превышает этот порог (значение: %)"
|
||||||
|
"tgNotifyMem" = "RAM Load Notification"
|
||||||
|
"tgNotifyMemDesc" = "Get notified if RAM load exceeds this threshold. (unit: %)"
|
||||||
|
"restartAtMemThreshold" = "Restart Xray when the threshold is reached"
|
||||||
|
"restartAtMemThresholdDesc" = "When the RAM utilization reaches the specified percentage, Xray will be restarted"
|
||||||
"timeZone" = "Часовой пояс"
|
"timeZone" = "Часовой пояс"
|
||||||
"timeZoneDesc" = "Запланированные задачи выполняются в соответствии со временем в этом часовом поясе"
|
"timeZoneDesc" = "Запланированные задачи выполняются в соответствии со временем в этом часовом поясе"
|
||||||
"subSettings" = "Подписка"
|
"subSettings" = "Подписка"
|
||||||
|
@ -493,6 +497,7 @@
|
||||||
|
|
||||||
[tgbot.messages]
|
[tgbot.messages]
|
||||||
"cpuThreshold" = "🔴 Загрузка процессора составляет {{ .Percent }}%, что превышает пороговое значение {{ .Threshold }}%"
|
"cpuThreshold" = "🔴 Загрузка процессора составляет {{ .Percent }}%, что превышает пороговое значение {{ .Threshold }}%"
|
||||||
|
"memThreshold" = "🔴 RAM Threshold\r\nThe {{ .Threshold }}% threshold has been reached. Reboot performed"
|
||||||
"selectUserFailed" = "❌ Ошибка при выборе пользователя!"
|
"selectUserFailed" = "❌ Ошибка при выборе пользователя!"
|
||||||
"userSaved" = "✅ Пользователь Telegram сохранен."
|
"userSaved" = "✅ Пользователь Telegram сохранен."
|
||||||
"loginSuccess" = "✅ Успешный вход в панель.\r\n"
|
"loginSuccess" = "✅ Успешный вход в панель.\r\n"
|
||||||
|
|
|
@ -282,6 +282,10 @@
|
||||||
"trafficDiffDesc" = "Bu eşik seviyesine ulaşıldığında trafik sınırı hakkında bildirim alın. (birim: GB)"
|
"trafficDiffDesc" = "Bu eşik seviyesine ulaşıldığında trafik sınırı hakkında bildirim alın. (birim: GB)"
|
||||||
"tgNotifyCpu" = "CPU Yükü Bildirimi"
|
"tgNotifyCpu" = "CPU Yükü Bildirimi"
|
||||||
"tgNotifyCpuDesc" = "CPU yükü bu eşik seviyesini aşarsa bildirim alın. (birim: %)"
|
"tgNotifyCpuDesc" = "CPU yükü bu eşik seviyesini aşarsa bildirim alın. (birim: %)"
|
||||||
|
"tgNotifyMem" = "RAM Load Notification"
|
||||||
|
"tgNotifyMemDesc" = "Get notified if RAM load exceeds this threshold. (unit: %)"
|
||||||
|
"restartAtMemThreshold" = "Restart Xray when the threshold is reached"
|
||||||
|
"restartAtMemThresholdDesc" = "When the RAM utilization reaches the specified percentage, Xray will be restarted"
|
||||||
"timeZone" = "Saat Dilimi"
|
"timeZone" = "Saat Dilimi"
|
||||||
"timeZoneDesc" = "Planlanmış görevler bu saat dilimine göre çalışacaktır."
|
"timeZoneDesc" = "Planlanmış görevler bu saat dilimine göre çalışacaktır."
|
||||||
"subSettings" = "Abonelik"
|
"subSettings" = "Abonelik"
|
||||||
|
@ -493,6 +497,7 @@
|
||||||
|
|
||||||
[tgbot.messages]
|
[tgbot.messages]
|
||||||
"cpuThreshold" = "🔴 CPU Yükü {{ .Percent }}% eşiği {{ .Threshold }}%'yi aşıyor"
|
"cpuThreshold" = "🔴 CPU Yükü {{ .Percent }}% eşiği {{ .Threshold }}%'yi aşıyor"
|
||||||
|
"memThreshold" = "🔴 RAM Threshold\r\nThe {{ .Threshold }}% threshold has been reached. Reboot performed"
|
||||||
"selectUserFailed" = "❌ Kullanıcı seçiminde hata!"
|
"selectUserFailed" = "❌ Kullanıcı seçiminde hata!"
|
||||||
"userSaved" = "✅ Telegram Kullanıcısı kaydedildi."
|
"userSaved" = "✅ Telegram Kullanıcısı kaydedildi."
|
||||||
"loginSuccess" = "✅ Panele başarıyla giriş yapıldı.\r\n"
|
"loginSuccess" = "✅ Panele başarıyla giriş yapıldı.\r\n"
|
||||||
|
|
|
@ -282,6 +282,10 @@
|
||||||
"trafficDiffDesc" = "Отримувати сповіщення про обмеження трафіку при досягненні цього порогу. (одиниця: ГБ)"
|
"trafficDiffDesc" = "Отримувати сповіщення про обмеження трафіку при досягненні цього порогу. (одиниця: ГБ)"
|
||||||
"tgNotifyCpu" = "Сповіщення про завантаження ЦП"
|
"tgNotifyCpu" = "Сповіщення про завантаження ЦП"
|
||||||
"tgNotifyCpuDesc" = "Отримувати сповіщення, якщо навантаження ЦП перевищує це порогове значення. (одиниця: %)"
|
"tgNotifyCpuDesc" = "Отримувати сповіщення, якщо навантаження ЦП перевищує це порогове значення. (одиниця: %)"
|
||||||
|
"tgNotifyMem" = "RAM Load Notification"
|
||||||
|
"tgNotifyMemDesc" = "Get notified if RAM load exceeds this threshold. (unit: %)"
|
||||||
|
"restartAtMemThreshold" = "Restart Xray when the threshold is reached"
|
||||||
|
"restartAtMemThresholdDesc" = "When the RAM utilization reaches the specified percentage, Xray will be restarted"
|
||||||
"timeZone" = "Часовий пояс"
|
"timeZone" = "Часовий пояс"
|
||||||
"timeZoneDesc" = "Заплановані завдання виконуватимуться на основі цього часового поясу."
|
"timeZoneDesc" = "Заплановані завдання виконуватимуться на основі цього часового поясу."
|
||||||
"subSettings" = "Підписка"
|
"subSettings" = "Підписка"
|
||||||
|
@ -493,6 +497,7 @@
|
||||||
|
|
||||||
[tgbot.messages]
|
[tgbot.messages]
|
||||||
"cpuThreshold" = "🔴 Навантаження ЦП {{ .Percent }}% перевищує порогове значення {{ .Threshold }}%"
|
"cpuThreshold" = "🔴 Навантаження ЦП {{ .Percent }}% перевищує порогове значення {{ .Threshold }}%"
|
||||||
|
"memThreshold" = "🔴 RAM Threshold\r\nThe {{ .Threshold }}% threshold has been reached. Reboot performed"
|
||||||
"selectUserFailed" = "❌ Помилка під час вибору користувача!"
|
"selectUserFailed" = "❌ Помилка під час вибору користувача!"
|
||||||
"userSaved" = "✅ Користувача Telegram збережено."
|
"userSaved" = "✅ Користувача Telegram збережено."
|
||||||
"loginSuccess" = "✅ Успішно ввійшли в панель\r\n"
|
"loginSuccess" = "✅ Успішно ввійшли в панель\r\n"
|
||||||
|
|
|
@ -282,6 +282,10 @@
|
||||||
"trafficDiffDesc" = "Nhận thông báo về việc cạn kiệt lưu lượng trước khi đạt đến ngưỡng này (đơn vị: GB)"
|
"trafficDiffDesc" = "Nhận thông báo về việc cạn kiệt lưu lượng trước khi đạt đến ngưỡng này (đơn vị: GB)"
|
||||||
"tgNotifyCpu" = "Ngưỡng cảnh báo tỷ lệ CPU"
|
"tgNotifyCpu" = "Ngưỡng cảnh báo tỷ lệ CPU"
|
||||||
"tgNotifyCpuDesc" = "Nhận thông báo nếu tỷ lệ sử dụng CPU vượt quá ngưỡng này (đơn vị: %)"
|
"tgNotifyCpuDesc" = "Nhận thông báo nếu tỷ lệ sử dụng CPU vượt quá ngưỡng này (đơn vị: %)"
|
||||||
|
"tgNotifyMem" = "RAM Load Notification"
|
||||||
|
"tgNotifyMemDesc" = "Get notified if RAM load exceeds this threshold. (unit: %)"
|
||||||
|
"restartAtMemThreshold" = "Restart Xray when the threshold is reached"
|
||||||
|
"restartAtMemThresholdDesc" = "When the RAM utilization reaches the specified percentage, Xray will be restarted"
|
||||||
"timeZone" = "Múi giờ"
|
"timeZone" = "Múi giờ"
|
||||||
"timeZoneDesc" = "Các tác vụ được lên lịch chạy theo thời gian trong múi giờ này."
|
"timeZoneDesc" = "Các tác vụ được lên lịch chạy theo thời gian trong múi giờ này."
|
||||||
"subSettings" = "Gói đăng ký"
|
"subSettings" = "Gói đăng ký"
|
||||||
|
@ -493,6 +497,7 @@
|
||||||
|
|
||||||
[tgbot.messages]
|
[tgbot.messages]
|
||||||
"cpuThreshold" = "🔴 Sử dụng CPU {{ .Percent }}% vượt quá ngưỡng {{ .Threshold }}%"
|
"cpuThreshold" = "🔴 Sử dụng CPU {{ .Percent }}% vượt quá ngưỡng {{ .Threshold }}%"
|
||||||
|
"memThreshold" = "🔴 RAM Threshold\r\nThe {{ .Threshold }}% threshold has been reached. Reboot performed"
|
||||||
"selectUserFailed" = "❌ Lỗi khi chọn người dùng!"
|
"selectUserFailed" = "❌ Lỗi khi chọn người dùng!"
|
||||||
"userSaved" = "✅ Người dùng Telegram đã được lưu."
|
"userSaved" = "✅ Người dùng Telegram đã được lưu."
|
||||||
"loginSuccess" = "✅ Đăng nhập thành công vào bảng điều khiển.\r\n"
|
"loginSuccess" = "✅ Đăng nhập thành công vào bảng điều khiển.\r\n"
|
||||||
|
|
|
@ -282,6 +282,10 @@
|
||||||
"trafficDiffDesc" = "达到此阈值时,将收到有关流量耗尽的通知(单位:GB)"
|
"trafficDiffDesc" = "达到此阈值时,将收到有关流量耗尽的通知(单位:GB)"
|
||||||
"tgNotifyCpu" = "CPU 负载通知阈值"
|
"tgNotifyCpu" = "CPU 负载通知阈值"
|
||||||
"tgNotifyCpuDesc" = "CPU 负载超过此阈值时,将收到通知(单位:%)"
|
"tgNotifyCpuDesc" = "CPU 负载超过此阈值时,将收到通知(单位:%)"
|
||||||
|
"tgNotifyMem" = "RAM Load Notification"
|
||||||
|
"tgNotifyMemDesc" = "Get notified if RAM load exceeds this threshold. (unit: %)"
|
||||||
|
"restartAtMemThreshold" = "Restart Xray when the threshold is reached"
|
||||||
|
"restartAtMemThresholdDesc" = "When the RAM utilization reaches the specified percentage, Xray will be restarted"
|
||||||
"timeZone" = "时区"
|
"timeZone" = "时区"
|
||||||
"timeZoneDesc" = "定时任务将按照该时区的时间运行"
|
"timeZoneDesc" = "定时任务将按照该时区的时间运行"
|
||||||
"subSettings" = "订阅设置"
|
"subSettings" = "订阅设置"
|
||||||
|
@ -493,6 +497,7 @@
|
||||||
|
|
||||||
[tgbot.messages]
|
[tgbot.messages]
|
||||||
"cpuThreshold" = "🔴 CPU 使用率为 {{ .Percent }}%,超过阈值 {{ .Threshold }}%"
|
"cpuThreshold" = "🔴 CPU 使用率为 {{ .Percent }}%,超过阈值 {{ .Threshold }}%"
|
||||||
|
"memThreshold" = "🔴 RAM Threshold\r\nThe {{ .Threshold }}% threshold has been reached. Reboot performed"
|
||||||
"selectUserFailed" = "❌ 用户选择错误!"
|
"selectUserFailed" = "❌ 用户选择错误!"
|
||||||
"userSaved" = "✅ 电报用户已保存。"
|
"userSaved" = "✅ 电报用户已保存。"
|
||||||
"loginSuccess" = "✅ 成功登录到面板。\r\n"
|
"loginSuccess" = "✅ 成功登录到面板。\r\n"
|
||||||
|
|
|
@ -282,6 +282,10 @@
|
||||||
"trafficDiffDesc" = "達到此閾值時,將收到有關流量耗盡的通知(單位:GB)"
|
"trafficDiffDesc" = "達到此閾值時,將收到有關流量耗盡的通知(單位:GB)"
|
||||||
"tgNotifyCpu" = "CPU 負載通知閾值"
|
"tgNotifyCpu" = "CPU 負載通知閾值"
|
||||||
"tgNotifyCpuDesc" = "CPU 負載超過此閾值時,將收到通知(單位:%)"
|
"tgNotifyCpuDesc" = "CPU 負載超過此閾值時,將收到通知(單位:%)"
|
||||||
|
"tgNotifyMem" = "RAM Load Notification"
|
||||||
|
"tgNotifyMemDesc" = "Get notified if RAM load exceeds this threshold. (unit: %)"
|
||||||
|
"restartAtMemThreshold" = "Restart Xray when the threshold is reached"
|
||||||
|
"restartAtMemThresholdDesc" = "When the RAM utilization reaches the specified percentage, Xray will be restarted"
|
||||||
"timeZone" = "時區"
|
"timeZone" = "時區"
|
||||||
"timeZoneDesc" = "定時任務將按照該時區的時間執行"
|
"timeZoneDesc" = "定時任務將按照該時區的時間執行"
|
||||||
"subSettings" = "訂閱設定"
|
"subSettings" = "訂閱設定"
|
||||||
|
@ -493,6 +497,7 @@
|
||||||
|
|
||||||
[tgbot.messages]
|
[tgbot.messages]
|
||||||
"cpuThreshold" = "🔴 CPU 使用率為 {{ .Percent }}%,超過閾值 {{ .Threshold }}%"
|
"cpuThreshold" = "🔴 CPU 使用率為 {{ .Percent }}%,超過閾值 {{ .Threshold }}%"
|
||||||
|
"memThreshold" = "🔴 RAM Threshold\r\nThe {{ .Threshold }}% threshold has been reached. Reboot performed"
|
||||||
"selectUserFailed" = "❌ 使用者選擇錯誤!"
|
"selectUserFailed" = "❌ 使用者選擇錯誤!"
|
||||||
"userSaved" = "✅ 電報使用者已儲存。"
|
"userSaved" = "✅ 電報使用者已儲存。"
|
||||||
"loginSuccess" = "✅ 成功登入到面板。\r\n"
|
"loginSuccess" = "✅ 成功登入到面板。\r\n"
|
||||||
|
|
|
@ -290,6 +290,12 @@ func (s *Server) startTask() {
|
||||||
if (err == nil) && (cpuThreshold > 0) {
|
if (err == nil) && (cpuThreshold > 0) {
|
||||||
s.cron.AddJob("@every 10s", job.NewCheckCpuJob())
|
s.cron.AddJob("@every 10s", job.NewCheckCpuJob())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check RAM and alarm to TgBot if threshold passes
|
||||||
|
memThreshold, err := s.settingService.GetTgMem()
|
||||||
|
if (err == nil) && (memThreshold > 0) {
|
||||||
|
s.cron.AddJob("@every 10s", job.NewCheckMemJob())
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
s.cron.Remove(entry)
|
s.cron.Remove(entry)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue