1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| """ 告警通知脚本 异常任务,邮件通知
@author zhangquanquan 20-01-10 下午3:49
"""
import requests import json
headers = {'content-type': 'application/json'}
def notify(receivers, subject, content): notify_url = 'http://192.168.0.23:8060/heimdallr/upload/api/notifyByEmail' data = {'receivers': receivers, 'subject': subject, 'content': content} r = requests.post(notify_url,data=json.dumps(data),headers=headers) try: rd = json.loads(r.content.decode('utf-8')) print (rd) except Exception: print (r.content) print (strategyName, dataDate, message, "处理异常", sep=',') return rd
|