diff --git a/class/core/mw.py b/class/core/mw.py index 2ebac51a1..aee8585c6 100755 --- a/class/core/mw.py +++ b/class/core/mw.py @@ -542,6 +542,14 @@ def getDate(): return time.strftime('%Y-%m-%d %X', time.localtime()) +def getDateFromNow(tf_format="%Y-%m-%d %H:%M:%S", time_zone="Asia/Shanghai"): + # 取格式时间 + import time + os.environ['TZ'] = time_zone + time.tzset() + return time.strftime(tf_format, time.localtime()) + + def getDataFromInt(val): time_format = '%Y-%m-%d %H:%M:%S' time_str = time.localtime(val) diff --git a/task.py b/task.py index 50630fe40..039e437d0 100755 --- a/task.py +++ b/task.py @@ -259,7 +259,8 @@ def systemTask(): if tmp['used'] > 80: panel_title = mw.getConfig('title') ip = mw.getHostAddr() - msg = '节点[' + panel_title + ':' + ip + \ + now_time = getDateFromNow() + msg = now_time + '|节点[' + panel_title + ':' + ip + \ ']处于高负载[' + str(tmp['used']) + '],请排查原因!' mw.notifyMessage(msg, '面板监控', 600)