Ver código fonte

feat:添加监控脚本配置打印

zhaohaipeng 7 meses atrás
pai
commit
9f2e181dbb
1 arquivos alterados com 15 adições e 3 exclusões
  1. 15 3
      script/feature_spark_monitor.py

+ 15 - 3
script/feature_spark_monitor.py

@@ -120,16 +120,28 @@ def send_error_info(table_name: str, warn_reason: str, webhook: str):
     feishu_inform_util.send_card_msg_to_feishu(webhook, card_json)
 
 
+def print_config(config_path):
+    print(f"配置文件路径: {config_path}")
+    config = configparser.ConfigParser()
+    config.read(config_path)
+    for section in config.sections():
+        print(f"[{section}]")
+        for key, value in config.items(section):
+            print(f"{key} = {value}")
+
+
 def _main():
     parser = argparse.ArgumentParser(description="feature_spark_task_monitor")
     parser.add_argument("-c", "--config", required=False, help="config file path",
                         default="/home/monitor/model_monitor/config/config.ini")
     args = parser.parse_args()
+    print_config(args.config)
 
     # 读取配置文件
-    config = configparser.ConfigParser()
-    config.read(args.config)
-    webhook_url = config.get("feishu", "model.webhook")
+    # config = configparser.ConfigParser()
+    # config.read(args.config)
+    # webhook_url = config.get("feishu", "model.webhook")
+    webhook_url = 'https://open.feishu.cn/open-apis/bot/v2/hook/540d4098-367a-4068-9a44-b8109652f07c'
 
     # 获取最近4小时的Spark任务
     hours_7_early = int((datetime.now() - timedelta(hours=4)).timestamp()) * 1000