This is a simple custom alert script for Zabbix which allows sending alerts via the vonage SMS gateway (formerly known as "nexmo").
Any shell POSIX compatible shell (no need for bash
).
This script has been used successfully with:
- Zabbix 3
- Zabbix 4
- Zabbix 5
- Zabbix 6
on Ubuntu, CentOS and FreeBSD based Zabbix servers.
Place a copy of the ./send_sms_vonage.sh
script under <zabbix_installation>/alertscripts/
.
For example, under FreeBSD, this would be /usr/local/etc/zabbix6/zabbix/alertscripts/send_sms_vonage.sh
when using the zabbix6-server
port.
Make sure that the script is executable by the user that runs the zabbix server. This is usually the zabbix
user.
Next, open the script and modify the API_KEY
and API_SECRET
variables according to your vonage account information.
At this point it makes sense to check whether the zabbix
user can run the script successfully:
sudo -u zabbix <zabbix_installation>/alertscripts/send_sms_vonage.sh <your_phone_number> "Test" "This is a test message!"
The script accepts (and expects!) three arguments:
$1
: The recipient phone number$2
: A short description/title$3
: The detailed message
After installation and successful verification that the user running the zabbix server can run the script the zabbix server must be configured to use this script. Follow these steps:
- Log into your Zabbix front-end
- Navigate to
Administration -> Media types
- Create a new media type
- Specify a suitable name such as
SMS - Vonage.com
- Set
Type
toScript
- Set
Script name
tosend_sms_vonage.sh
- Add three parameters:
{ALERT.SENDTO}
{ALERT.SUBJECT}
{ALERT.MESSAGE}
- Click
Add
to register the new media type
- Test the new media type:
- Go back to
Administration -> Media types
- Click
Test
in theSMS - Vonage.com
row (or whatever name you assigned) - Enter your (or just "a") phone number in the
Send to
field - Hit "Test"
- You should receive an SMS sent by the Zabbix server
- Assign the media type to the user(s) that want to receive SMS notifications
Common problems:
- Check whether script is executable by the user running the zabbix server (the
zabbix
user by default). - Ensure that the value of the
BIN_CURL
variable of the shell script contains an absolute path as thePATH
environment variable won't be populated (by default).