添加设备监控,第一次上线邮件提醒
This commit is contained in:
parent
369264e695
commit
288f5a0db6
|
|
@ -76,7 +76,8 @@ func SetDeviceStatusV2(c *gin.Context) {
|
|||
if v == req.ID {
|
||||
// 继续处理请求
|
||||
//是否是暂停之后第一次上线,如果是则发送邮件通知
|
||||
if worker.IsContainKey("monitor_"+req.ID) == false {
|
||||
device_status := worker.GetRedis("monitor_" + req.ID)
|
||||
if device_status == "2" {
|
||||
//发送邮件通知
|
||||
title := "设备上线"
|
||||
content := "设备上线\n设备:" + req.ID + "\t状态:" + req.Status + "\t时间:" + time.Now().String()
|
||||
|
|
@ -329,7 +330,7 @@ func ScanDeviceStatus() {
|
|||
for _, v := range devices {
|
||||
c := worker.IsContainKey("monitor_" + v)
|
||||
if c == false {
|
||||
worker.SetRedisWithExpire("monitor_"+v, "1", time.Hour*24)
|
||||
worker.SetRedisWithExpire("monitor_"+v, "2", time.Hour*24)
|
||||
offline += v + ","
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue