/zabbix

Primary LanguagePython

Zabbix SMS Plugin

Zabbix SMS notification via D7SMS allows to sending of worldwide SMS notifications for each host and service.

For FREE sms credits signup at https://d7networks.com.

We used a Python script for sending SMS notifications in the Zabbix platform using D7SMS gateway.

Getting Started

These instructions will get you a copy of the script and configuration guidelines for setting it up in Zabbix

Prerequisites


Zabbix Setup

  • Get "AlertScriptsPath" of Zabbix setup from zabbix_server.conf (also you can get the default path from the following command) and navigate to same.
  • Default AlertScriptsPath is: /usr/lib/zabbix/alertscripts
     zabbix_server --help | grep AlertScriptsPath
     or
     cat /etc/zabbix/zabbix_server.conf | grep "AlertScriptsPath"
      

Get Script Path

  • Download D7SMS script from here and make it executable
     cd /usr/lib/zabbix/alertscripts
     wget https://raw.githubusercontent.com/d7networks/zabbix/master/d7sms.py
     chmod +x /usr/lib/zabbix/alertscripts/d7sms.py

Get Script Path

     vim /usr/lib/zabbix/alertscripts/d7sms.py +7

     Update line number 7 
     D7TOKEN = "eyJhbGciOiJIUzI1NiIsInR......."

Get Script Path

  • You can now test the script using the following command (remember to replace the destination number).
     ./d7sms.py 971509752655 "Test from Zabbix"

Get Script Path

  • Open Zabbix panel and navigate to Alerts > Media Types and click on Create media type and input following details
     Name:D7SMS
     Type:Script
     Script name:d7sms.py
     Script parameters
          {ALERT.SENDTO}
          {ALERT.MESSAGE}
  • Click on Message templates tab on the same window and click add.

    Select Message type as Problem, and you will get a predefined script. Click on add.

  • Now add one more template for Recovery.

    Select Message type Problem Recovery and click add.

    Click on Update once you've added all the templates.

  • Once created media type, Goto Users and click on the desired User

    Then select the Media tab and click on Add

Get Script Path

     Choose Type: D7SMS
     Add destination number with country code for the option `Send to`
     Select the type of alert (severity) required and `enable` it. 
  • Click on Update and the alerts will be generated.

Get Script Path

  • Also, you can check the /var/log/zabbix directory for logs in case if you need to check for errors

Video documentation

Watch the video


Support and Update

You can get the latest version of this script from Github: https://github.com/d7networks/zabbix

For all queries and help with installation please contact support@d7networks.com