mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-12-23 14:52:43 +00:00
Compare commits
2 commits
633194bee2
...
bf20839fdf
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bf20839fdf | ||
|
|
f000322a06 |
1 changed files with 5 additions and 1 deletions
|
|
@ -22,7 +22,11 @@ func NewCheckCpuJob() *CheckCpuJob {
|
||||||
|
|
||||||
// Run checks CPU usage over the last minute and sends a Telegram alert if it exceeds the threshold.
|
// Run checks CPU usage over the last minute and sends a Telegram alert if it exceeds the threshold.
|
||||||
func (j *CheckCpuJob) Run() {
|
func (j *CheckCpuJob) Run() {
|
||||||
threshold, _ := j.settingService.GetTgCpu()
|
threshold, err := j.settingService.GetTgCpu()
|
||||||
|
if err != nil || threshold <= 0 {
|
||||||
|
// If threshold cannot be retrieved or is not set, skip sending notifications
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// get latest status of server
|
// get latest status of server
|
||||||
percent, err := cpu.Percent(1*time.Minute, false)
|
percent, err := cpu.Percent(1*time.Minute, false)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue