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
45e706ad
authored
Oct 10, 2025
by
陈森彬
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
日志记录告警机器人的内容
parent
2ebcbca4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
2 deletions
utils/robots.py
utils/robots.py
View file @
45e706ad
...
...
@@ -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")
...
...
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