From 70d8e702fd1dc685f0acf18887a0bb89e7d16f62 Mon Sep 17 00:00:00 2001 From: liuwei Date: Tue, 27 May 2025 09:28:32 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E7=9B=91=E6=8E=A7=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.yaml | 3 +++ configuration.py | 4 +++- main.py | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/config.yaml b/config.yaml index 39e7a4c..8a5e7d4 100644 --- a/config.yaml +++ b/config.yaml @@ -111,3 +111,6 @@ email_config: sender_password: "LTS9BhmX9XhS36QS" alert_recipient: "bovine_liu@163.com" # 警报邮件接收者 +glances: + host: "192.168.2.170" + port: 61208 \ No newline at end of file diff --git a/configuration.py b/configuration.py index 19e0f1c..d95faf3 100644 --- a/configuration.py +++ b/configuration.py @@ -41,6 +41,8 @@ class Config(object): # DB config self.mariadb = yconfig.get("db_config", {}) self.redis = yconfig.get("redis_config", {}) - + # Email config self.email = yconfig.get("email_config", {}) + # glances 监控配置 + self.glances = yconfig.get("glances", {}) diff --git a/main.py b/main.py index 7020c62..594d8c4 100644 --- a/main.py +++ b/main.py @@ -72,8 +72,8 @@ def main(): # 初始化 Glances 监控 monitor = GlancesMonitor( email_sender=robot.email_sender, - host='192.168.2.170', - port=61208, + host=config.glances.get("host"), + port=config.glances.get("port"), cpu_threshold=80.0, load_threshold=None, # 自动设为 CPU 核心数 * 2 io_threshold=80.0,