1. SMS Interface Document:
Urlhttp://xxx.com/interfaces/sendmsg.htmmethodpostdescription Text SMS Call interface Request Param List
Name |
Identifier |
Type |
Remark |
SMS Signature |
Sign |
String |
The format is "XXX platform" Chinese brackets are not few |
Information content |
Msg |
String |
|
Phone number |
PhoneNumber |
String |
|
Response Param List
Name |
Identifier |
Type |
Remark |
return value |
|
String |
Commit failed {"MSG": "", "Success": "F"} Commit succeeded {"MSG": "", "Success": "T"} |
2. Custom port post mode and Python script:
#!/usr/bin/env python#-*-coding:utf-8-*-#Author: lzdimport sysimport urllib.requestimport urllib.parse# Request msg = Sys.argv[2]phonenumber = Sys.argv[1]data = {' msg ': Msg, ' PhoneNumber ':p honenumber,}data = urllib.parse.urlencode (data) . Encode (' utf-8 ') ResU = Urllib.request.urlopen (' http://xxx.com/interfaces/sendVoice.htm ', data = data) #指定编码请求 #print ( Resu.read (). Decode (' Utf-8 ')) a=open ('/tmp/abc.log ', ' a ') A.write (Sys.argv[1]+resu.read (). Decode (' utf-8 ') + ' \ n ') A.close ()
3. Copy the sms2.py to the path/usr/lib/zabbix/alertscripts
4, set the sms2.py permissions for chmod 777 sms2.py
5, note sms2.py in CentOS must be able to directly execute, and not Python sms2.py this way directly. Add two parameters to the back phone number + content
6, set the triggers in Zabbix
7. Set media type, note that the three variables here must be added.
8. Last set action: actions
When the triggers name is called, or the security level why the time triggered action, send text messages directly, select the corresponding people and actions!
Zabbix to increase the attention points of mobile phone SMS monitoring