Zabbix to increase the attention points of mobile phone SMS monitoring

Source: Internet
Author: User
Tags python script

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.