From bb148f9bea2786e1e54ebb54f0e71c241612a77a Mon Sep 17 00:00:00 2001 From: UlricQin Date: Fri, 23 Jul 2021 21:15:23 +0800 Subject: [PATCH] add more log --- alert/consume.go | 2 +- etc/script/notify.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/alert/consume.go b/alert/consume.go index 53de1509..f0e15c9d 100644 --- a/alert/consume.go +++ b/alert/consume.go @@ -208,7 +208,7 @@ func notify(alertMsg AlertMsg) { } if err != nil { - logger.Errorf("notify: exec script %s occur error: %v", fpath, err) + logger.Errorf("notify: exec script %s occur error: %v, output: %s", fpath, err, buf.String()) return } diff --git a/etc/script/notify.py b/etc/script/notify.py index fce11259..9cb37f3b 100755 --- a/etc/script/notify.py +++ b/etc/script/notify.py @@ -5,6 +5,7 @@ import json import os import smtplib import time +import requests from email.mime.text import MIMEText from email.header import Header @@ -29,7 +30,6 @@ from email.header import Header # 3. 告警通道需要自行定义Send类中的send_xxx同名方法,反射调用:举例 event.notify_channels = [qq dingding] 则需要Send类中 有 send_qq send_dingding方法 # 4. im发群信息,比如钉钉发群信息需要群的webhook机器人 token,这个信息可以在user的contacts map中,各个send_方法处理即可 # 5. 用户创建一个虚拟的用户保存上述im群 的机器人token信息 user的contacts map中 -import requests mail_host = "smtp.163.com" mail_port = 994