Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
lichenggang
/
tas_monitor
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
d8e6d9af
authored
May 14, 2024
by
陈森彬
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
添加微信告警机器人
parent
d1a4fdde
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
utils/robots.py
utils/robots.py
View file @
d8e6d9af
...
@@ -7,6 +7,9 @@ import re
...
@@ -7,6 +7,9 @@ import re
dd_robot_api
=
' https://oapi.dingtalk.com/robot/send?access_token='
dd_robot_api
=
' https://oapi.dingtalk.com/robot/send?access_token='
tom
=
'c19beeab837f5c6e019e7fc602d470704d634ae33510f40fb0e903cde215fb24'
tom
=
'c19beeab837f5c6e019e7fc602d470704d634ae33510f40fb0e903cde215fb24'
wechat_robot_api
=
"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key="
tom_key
=
"bb2b5b4e-9a06-4d3d-89f5-61bcf07ed4ba"
filter_plat_kw
=
[
'pc'
,
'bkc'
]
filter_plat_kw
=
[
'pc'
,
'bkc'
]
wrong_ratio_pat
=
re
.
compile
(
r'\d\d\.\d\d'
)
wrong_ratio_pat
=
re
.
compile
(
r'\d\d\.\d\d'
)
msgapi_url
=
'http://api.ichunt.com/msg/sendMessageByAuto'
msgapi_url
=
'http://api.ichunt.com/msg/sendMessageByAuto'
...
@@ -29,14 +32,14 @@ def parse_msg(msg):
...
@@ -29,14 +32,14 @@ def parse_msg(msg):
return
msgs
return
msgs
def
dd_send_msg
(
msg
,
robot
=
tom
):
def
dd_send_msg
(
msg
,
robot
=
tom
_key
):
data
=
{
data
=
{
"msgtype"
:
"text"
,
"msgtype"
:
"text"
,
"text"
:
{
"text"
:
{
"content"
:
msg
"content"
:
msg
}
}
}
}
requests
.
post
(
dd
_robot_api
+
robot
,
json
=
data
)
requests
.
post
(
wechat
_robot_api
+
robot
,
json
=
data
)
time
.
sleep
(
5
)
time
.
sleep
(
5
)
phone_msgs
=
parse_msg
(
msg
)
phone_msgs
=
parse_msg
(
msg
)
...
@@ -55,10 +58,10 @@ def dd_send_msg(msg, robot=tom):
...
@@ -55,10 +58,10 @@ def dd_send_msg(msg, robot=tom):
'fromuser'
:
''
,
'wechat_data'
:
''
,
'is_oversea'
:
''
,
'channel_type'
:
''
,
'is_ignore'
:
''
,
'ex_int'
:
''
,
'fromuser'
:
''
,
'wechat_data'
:
''
,
'is_oversea'
:
''
,
'channel_type'
:
''
,
'is_ignore'
:
''
,
'ex_int'
:
''
,
'ex_str'
:
''
,
'k2'
:
d
.
hexdigest
(),
'k1'
:
str
(
cur_time
)}
'ex_str'
:
''
,
'k2'
:
d
.
hexdigest
(),
'k1'
:
str
(
cur_time
)}
requests
.
post
(
msgapi_url
,
data
=
data
)
requests
.
post
(
msgapi_url
,
data
=
data
)
# print("didididi")
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
dd_send_msg
(
'''TAS任务监控预警 过去90分钟内:
dd_send_msg
(
'''
测试
TAS任务监控预警 过去90分钟内:
任务:muguf 未知 平均错误率为81.30
%
任务:muguf 未知 平均错误率为81.30
%
任务:pc 平台比价 平均错误率为97.99
%
任务:pc 平台比价 平均错误率为97.99
%
任务:bkc buerklin新品采集 平均错误率为72.97
%
'''
)
任务:bkc buerklin新品采集 平均错误率为72.97
%
'''
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment