ES

SMS integration with Zabbix

Send SMS notifications through the LabsMobile platform integrated with the Zabbix network monitoring system. Configure your Zabbix application to send alerts and notifications via SMS in seconds with LabsMobile.


Functionalities

  • Sending alerts.

Requirements

  • Zabbix application installed and running. More information at zabbix.com .
  • A LabsMobile user account. Follow the link below to create a new account: Register.
  • Have the cURL library installed in PHP. More information at curl.installation.php

Important For this module to work correctly, it is essential that the cURL library is installed and enabled in your Zabbix PHP environment.


Authentication

In the integration with Zabbix the authentication is performed with two parameters:

  • The username of the account to be entered in the username field.
  • The tokenapi to be assigned in the password field. This tokenapi can be generated from the API Settings section of your account.

Recommendation You can generate API tokens from the API Settings of the account. We recommend changing the token frequently and using different tokens for each use, connection or integration.


Installation

  1. Download the LabsMobile SMS module for Zabbix in a .zip file or clone our GitHub repository.

LabsMobile Module

Click on the following link and download the LabsMobile SMS Module.


  1. Copy all files to the alerts scripts directory (AlertScripts) of your Zabbix instance. The directory path is /usr/lib/zabbix/alertscripts.
  1. Configure the permissions and the owner of the files and directories.
Permits
chown -R zabbix:zabbix /usr/lib/zabbix/alertscripts
chown -R zabbix:zabbix /var/log/zabbix-server/sms/
chmod 755 /usr/lib/zabbix/alertscripts/sms.php
  

  1. Specify the LabsMobile credentials username and tokenapi in the config.php file located in the /usr/lib/zabbix/alertscripts path. You can also indicate the sender of your preference.
Authentication
<?php 
define('GATEWAY_TYPE', 'LabsMobile');
define('GATEWAY_PARAMS', [
    'username' => 'myUsername',
    'password' => 'myToken',
    'sender' => 'Zabbix',
]);
  
  1. In Zabbix, go to Administration > Media Types or Alerts > Media Types, depending on the version you are using


  1. Create a new Media Type, indicating the name of the script, the type as script and in Script name enter sms.php. Finally, add the following parameters: {ALERT.SENDTO}, {ALERT.SUBJECT},{ALERT.MESSAGE} and click Add.


  1. In Zabbix, go to Administration > Users, edit a user that has a mobile number associated with it and assign the user to the script created, indicating the script name and mobile number.


  1. Test the script from the Zabbix dashboard in the Administration > Media Types or Alerts > Media Types option. Find the name of the scrip, click on the Test option and specify all the script parameters.


  1. You can also test from the terminal
Send SMS
 
su -l zabbix -s /bin/bash
cd /usr/lib/zabbix/alertscripts
./sms.php 31123451234 "test" "this is a test"
  
  1. You can check the SMS sent in the /var/log/zabbix-server/sms/ directory.