Zabbix Sending SMS principles via scripting
and Zabbix email is the same, they are the action internal configuration, the Division API to complete. Of course, there are many on the Internet using 139 of mailboxes to send, this is actually called a call email, here is to repeat the method called script.
Step
- Write a script that sends text messages. Plus the operational permissions.
- Administration-> Medis types inside create. Type select Script. Fill in the name of your script.
- Specify Alertscriptspath in the configuration file for the server.
Note that this folder can be visited by Zabbix.
- Restart the server.
- Configured in action.
- The individual user's media is configured with a mobile phone number.
Finally, attach a Python script
#!/usr/bin/python#coding: Utf-8ImportUrllib2ImportUrllibImportSys def sendm(mobile,content):URL =' http://xxx/sms.aspx 'data = Urllib.urlencode ({"userid":' xx ',"Account":' xx ',"Password":' xxx ',"mobile": Mobile,"Content": Content,"Sendtime":"","Action":"Send","Extno":""}) req = Urllib2. Request (url,data) res = Urllib2.urlopen (req)PrintRes.read () number=sys.argv[1]msg=sys.argv[2]SENDM (NUMBER,MSG)
In fact, in very many cases, the script calls the Urllib2 module, which is able to see my previous documents. Python urllib2 module
Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.
Zabbix sending text messages via scripts