Send SMS notifications through the LabsMobile platform from the Zabbix application. Configure your open source instance of Zabbix so that you can send alerts and notifications via SMS with LabsMobile.
Labsmobile API documentation can be found here.
- Sending alerts.
- Zabbix app installed and working. More information in zabbix.com.
- A user account with LabsMobile. Click on the link to create an account here.
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.
- Download the LabsMobile SMS module for Zabbix in a .zip file or clone our GitHub repository.
- Copy all files to the AlertScripts directory of your Zabbix instance. The directory path is
/usr/lib/zabbix/alertscripts.
- Configure the permissions and the owner of the files and directories.
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
- Specify the LabsMobile credentials
username:tokenapi
in the config.php file located in the/usr/lib/zabbix/alertscripts
path. You can also indicate the sender of your choice.
define('GATEWAY_TYPE', 'LabsMobile');
define('GATEWAY_PARAMS', [
'username' => 'myUsername',
'password' => 'myToken',
'sender' => 'Zabbix',
]);
- In Zabbix, go to Administration > Media Types or Alerts > Media Types, depending on the version you are using.
- 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. - In Zabbix, go toAdministration > 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.
- Test the script from the Zabbix dashboard in the Administration > Media Types or Alerts > Media Types option. Find the name of the script, click on the Test option and specify all the script parameters.
- You can also test from the terminal.
su -l zabbix -s /bin/bash
cd /usr/lib/zabbix/alertscripts
./sms.php 31123451234 "test" "this is a test"
If you have questions, you can contact us through the support chat or through the support email [email protected].