Integrating Zabbix with Jasmin SMS Gateway for SMS Alerts
Monitoring infrastrcture is only helpful if you can know when something goes wrong before your customers or users. While Zabbix provides several notification methods out of the box, they might not be sufficient for your needs. One such case is when your telecom provider only provides SMPP to send SMS messages.
Jasmin is an open-source SMS gateway that can be used to send and receive SMS messages. It exposes an HTTP API that can be used to send and receive SMS messages, while in the backend it can connect to multiple SMS providers via SMPP.
In this guide, I will configure Zabbix to send SMS notifications through the Jasmin SMS Gateway using a custom Bash script.
The integration works by having Zabbix execute a script whenever an alert needs to be sent. The script communicates with the Jasmin Gateway through its HTTP API and delivers the SMS to the destination number.
Architecture
The notification flow is relatively simple:
+-------------+ Alert +------------------+
| | -----------------> | |
| Zabbix | | Bash SMS Script |
| Server | | |
+-------------+ +--------+---------+
|
| HTTP API
v
+---------------+
| |
| Jasmin Gateway|
| |
+-------+-------+
|
| SMS
v
+---------------+
| Mobile Phone |
+---------------+
When a Zabbix trigger generates an alert:
- Zabbix calls the Jasmin SMS script.
- The script checks whether the Jasmin Gateway is reachable.
- The script sends the SMS through the Jasmin HTTP API.
- The response from Jasmin is checked to determine whether the message was successfully submitted.
- The script logs the result for troubleshooting.
Prerequisites
For this guide, I already have
- A working Zabbix Server
- A working Jasmin SMS Gateway
- HTTP API access to the Jasmin Gateway
- A configured SMS sender/shortcode from my SMS provider
- A Jasmin username and password
curlinstalled on the Zabbix server
Create the Zabbix SMS Script
Zabbix allows external scripts to be used as notification media types. These scripts are normally stored in the directory defined by the AlertScriptsPath parameter in zabbix_server.conf.
You can check the configured path with:
grep AlertScriptsPath /etc/zabbix/zabbix_server.conf
On many Zabbix installations, the default directory is:
/usr/lib/zabbix/alertscripts
Create the SMS script:
sudo nano /usr/lib/zabbix/alertscripts/jasmin_send.sh
Add the following script:
#!/bin/bash
#
# Default zabbix script path: /usr/lib/zabbix/alertscripts
#
# Defining jasmin server information
jasmin_url="http://jasmin_gatway_ip_or_url"
jasmin_port="jasmin_port"
# Checing jasmin server status
jasmin_status=$(curl -s -X GET $jasmin_url:$jasmin_port/ping)
if [[ $jasmin_status == *"PONG"* ]]; then
# Retriving parameters
to=$1
message="$2 $3"
sms_shortcode="sms_shortcode_from_your_provider"
username="jasmin_user"
password="jasmin_password"
# Log the output of the bash script to a file
exec 3>&1 4>&2
trap 'exec 2>&4 1>&3' 0 1 2 3
exec 1>>/var/run/zabbix/log/jasmin_log.log 2>&1
echo "$(date +%Y-%m-%d_%H:%M:%S): Sending SMS Text to $1"
#Sending the request with all the necessary parameters
response=$(curl -X POST "$jasmin_url:$jasmin_port/send" \
--data-urlencode "to=$1" \
--data-urlencode "from=$sms_shortcode" \
--data-urlencode "content=$message" \
--data-urlencode "username=$username" \
--data-urlencode "password=$password")
# Check the response
if [ $? -eq 0 ]; then
if [[ $response == *"Success"* ]]; then
echo "Message sent successfully!"
else
echo "Error sending message: $response"
fi
else
echo "Error making the HTTP request."
fi
echo "$(date +%Y-%m-%d_%H:%M:%S): SMS Text sent to $1"
echo "MESSAGE: $2"
echo -e "---------------------------------------------------------------------------------------\n"
else
echo "Error making the HTTP request"
fi
Before saving the script, replace the following values with your actual Jasmin configuration:
jasmin_url="http://jasmin_gateway_ip_or_url"
jasmin_port="jasmin_port"
sms_shortcode="sms_shortcode_from_your_provider"
username="jasmin_user"
password="jasmin_password"
For example:
jasmin_url="http://192.168.10.50"
jasmin_port="1401"
sms_shortcode="XYZ"
username="zabbix"
password="your_password"
Set the Script Permissions
The Zabbix server normally executes alert scripts as the zabbix user.
Change the ownership of the script:
sudo chown zabbix:zabbix /usr/lib/zabbix/alertscripts/jasmin_send.sh
Then make it executable:
sudo chmod 750 /usr/lib/zabbix/alertscripts/jasmin_send.sh
The original implementation uses:
sudo chmod 777 /usr/lib/zabbix/alertscripts/jasmin_send.sh
Create the SMS Log File
The script writes its output to:
/var/run/zabbix/log/jasmin_log.log
Create the required directory if it doesn’t already exist:
sudo mkdir -p /var/run/zabbix/log
Create the log file:
sudo touch /var/run/zabbix/log/jasmin_log.log
Then give the Zabbix user ownership:
sudo chown -R zabbix:zabbix /var/run/zabbix/log
You can verify the permissions with:
ls -lah /var/run/zabbix/log/
Test the Script Manually
Before configuring the Zabbix frontend, it is a good idea to test the script directly.
Run it as the zabbix user:
sudo -u zabbix /usr/lib/zabbix/alertscripts/jasmin_send.sh \
"+2519XXXXXXXX" \
"Zabbix Alert" \
"Test SMS from Zabbix"
The script expects three parameters:
$1 = Destination phone number
$2 = Alert subject
$3 = Alert message
The script combines the second and third parameters:
message="$2 $3"
If the request is successful, you should see a response similar to:
Message sent successfully!
You can also check the log:
sudo tail -f /var/run/zabbix/log/jasmin_log.log
A successful entry should look similar to:
2026-08-08_23:30:00: Sending SMS text to +2519XXXXXXXX
Message sent successfully!
2026-08-08_23:30:00: SMS text sent to +2519XXXXXXXX
MESSAGE: Zabbix Alert Test SMS from Zabbix
---------------------------------------------------------------------------------------
If the script cannot reach Jasmin, verify the gateway connectivity and port:
curl -v http://JASMIN_GATEWAY_IP:JASMIN_PORT/ping
Create the Jasmin Media Type in Zabbix
Once the script works from the command line, configure it as a Zabbix Media Type.
From the Zabbix frontend, navigate to:
Alerts → Media types
Create a new media type.
Configure it as follows:
| Parameter | Value |
|---|---|
| Name | Jasmin |
| Type | Script |
| Script name | jasmin_send.sh |
| Status | Enabled |
For the script parameters, add the following in order:
{ALERT.SENDTO}
{ALERT.SUBJECT}
{ALERT.MESSAGE}
The parameters correspond to the arguments expected by our Bash script:
$1 → {ALERT.SENDTO}
$2 → {ALERT.SUBJECT}
$3 → {ALERT.MESSAGE}
Therefore, when Zabbix executes the script, it effectively runs something similar to:
/usr/lib/zabbix/alertscripts/jasmin_send.sh \
"+2519XXXXXXXX" \
"Server Down" \
"The server is unreachable."
Save the Media Type by clicking Add.
Test the Zabbix Media Type
After creating the media type, test it from the Media types page.
Select the Jasmin media type and click Test.
Provide a destination phone number and any required test values.
If everything is configured correctly:
Zabbix
|
| Alert
v
jasmin_send.sh
|
| HTTP POST
v
Jasmin Gateway
|
| SMS
v
Mobile Number
You should receive the test SMS on the specified phone number.
If the test fails, check the script log:
sudo tail -f /var/run/zabbix/log/jasmin_log.log
Assign the Jasmin Media Type to a Zabbix User
Creating the Media Type alone does not automatically send alerts.
The media type must be assigned to a Zabbix user.
Navigate to:
Users → Users
Select the user who should receive SMS notifications.
Under the user’s Media section, add:
Type: Jasmin
Send to: +2519XXXXXXXX
When active: 1-7, 00:00-24:00
Use if severity: Select the required severities
For critical infrastructure, you may want to enable SMS notifications only for high-severity alerts such as:
- High
- Disaster
This prevents unnecessary SMS messages for informational or low-priority events.