Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Ant_Devops
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mayi-operation
Ant_Devops
Commits
2a1333f4
Commit
2a1333f4
authored
Oct 27, 2018
by
ChongmingDu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add dingding alert
parent
d0ddf848
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
2 deletions
+43
-2
roles/zabbix_server/files/dingdingrobot.py
+29
-0
roles/zabbix_server/tasks/main.yml
+14
-2
No files found.
roles/zabbix_server/files/dingdingrobot.py
0 → 100644
View file @
2a1333f4
#!/usr/bin/python
# -*- coding: utf-8 -*-
import
requests
import
json
import
sys
import
os
headers
=
{
'Content-Type'
:
'application/json;charset=utf-8'
}
api_url
=
""
#dingding token
def
msg
(
text
):
json_text
=
{
"msgtype"
:
"text"
,
"at"
:
{
"atMobiles"
:
[
"13153669XXX"
],
"isAtAll"
:
False
},
"text"
:
{
"content"
:
text
}
}
print
requests
.
post
(
api_url
,
json
.
dumps
(
json_text
),
headers
=
headers
)
.
content
if
__name__
==
'__main__'
:
text
=
sys
.
argv
[
1
]
msg
(
text
)
\ No newline at end of file
roles/zabbix_server/tasks/main.yml
View file @
2a1333f4
...
...
@@ -29,4 +29,16 @@
src
:
zabbix.conf
dest
:
/etc/httpd/conf.d/zabbix.conf
notify
:
-
restart httpd
\ No newline at end of file
-
restart httpd
-
name
:
"
copy
dingding
robot
python
script"
copy
:
src
:
dingdingrobot.py
dest
:
/usr/lib/zabbix/alertscripts/dingdingrobot.py
-
name
:
"
run
dingding
robot
python
script"
file
:
path
:
/usr/lib/zabbix/alertscripts/dingdingrobot.py
owner
:
zabbix
group
:
zabbix
mode
:
0775
\ No newline at end of file
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