服务器监控
This commit is contained in:
19
main.py
19
main.py
@@ -3,6 +3,7 @@
|
||||
import asyncio
|
||||
import threading
|
||||
|
||||
from admin.GlancesMonitor import GlancesMonitor
|
||||
from utils.decorator.async_job import async_job
|
||||
from configuration import Config
|
||||
from plugins.xiuren_image.images_cache import ImageCacheManager
|
||||
@@ -67,6 +68,24 @@ def main():
|
||||
robot.LOG.error(f"Dashboard服务器启动失败: {e}")
|
||||
|
||||
asyncio.run(async_job.run_all())
|
||||
|
||||
try:
|
||||
# 初始化 Glances 监控
|
||||
monitor = GlancesMonitor(
|
||||
email_sender=robot.email_sender,
|
||||
host='localhost',
|
||||
port=61208,
|
||||
cpu_threshold=80.0,
|
||||
load_threshold=None, # 自动设为 CPU 核心数 * 2
|
||||
io_threshold=80.0,
|
||||
disk_usage_threshold=60.0,
|
||||
handle_threshold=20000,
|
||||
recipient=config.email.get("alert_recipient")
|
||||
)
|
||||
monitor.run()
|
||||
except Exception as e:
|
||||
robot.LOG.error(f"GlancesMonitor服务器启动失败: {e}")
|
||||
|
||||
# 让机器人一直跑
|
||||
robot.keep_running_and_block_process()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user