Commit 45e706ad by 陈森彬

日志记录告警机器人的内容

parent 2ebcbca4
Showing with 5 additions and 2 deletions
......@@ -4,6 +4,7 @@ import hashlib
import time
import requests
import re
from utils.log_manage import get_logger
dd_robot_api = ' https://oapi.dingtalk.com/robot/send?access_token='
tom = 'c19beeab837f5c6e019e7fc602d470704d634ae33510f40fb0e903cde215fb24'
......@@ -13,7 +14,7 @@ tom_key = "bb2b5b4e-9a06-4d3d-89f5-61bcf07ed4ba"
filter_plat_kw = ['pc', 'bkc']
wrong_ratio_pat = re.compile(r'\d\d\.\d\d')
msgapi_url = 'http://api.ichunt.com/msg/sendMessageByAuto'
robots_logger = get_logger('robots_push')
def parse_msg(msg):
lines = msg.split('\n')
......@@ -33,6 +34,7 @@ def parse_msg(msg):
def dd_send_msg(msg, robot=tom_key):
robots_logger.info(f"接受到要发警告信息的内容:{msg}")
data = {
"msgtype": "text",
"text": {
......@@ -52,11 +54,12 @@ def dd_send_msg(msg, robot=tom_key):
d = hashlib.md5()
m.update(str(cur_time).encode())
d.update((m.hexdigest() + 'fh6y5t4rr351d2c3bryi').encode())
robots_logger.info(f"构造警告短信的内容:{content}")
data = {'data': "{\"content\": \"%s\"}" % (content), 'touser': "[\"18211280017\",\"15113123231\"]",
'keyword': 'monitoring-py',
'fromuser': '', 'wechat_data': '', 'is_oversea': '', 'channel_type': '', 'is_ignore': '', 'ex_int': '',
'ex_str': '', 'k2': d.hexdigest(), 'k1': str(cur_time)}
robots_logger.info(f"请求警告短信api接口的内容:{data}")
requests.post(msgapi_url, data=data)
# print("didididi")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment