how to configure SMS in Zabbix using AWS SNS2 min read

Prabhin Prabharkaran Administrator
DevOps Engineer

He is a Technical professional. He is a person who loves to share tricks and tips on the Internet. He Posts what he does!

follow me

Hi All, this document deals with how to configure SMS in Zabbix using AWS SNS.
Zabbix is an open source monitoring software tool for diverse IT components, including networks, servers, virtual machines, and cloud services. Zabbix provides monitoring metrics, among others network utilization, CPU load and disk space consumption

Its required to have a monitoring system to monitor your infrastructure an including server, application, network device. Zabbix does this with an alerting system including emails and SMS. Since we have cloud service available for sending SMS here we are going to use AWS SNS ( simple notification service) for sending SMS rather than using GSM modem.

You can approach GSM modem when you have your monitoring system in On-premises, where is use cloud services when you deployed your monitoring system in the cloud.

So here I will guide you how to set up SMS alerts in Zabbix using AWS SNS.

prerequisites

1. AWS IAM user with access and a secret key which have access to SNS for sending SMS.
2. Installed Zabbix Server, if not installed check this link.

Configuration

login to Zabbix server via SSH and create a sns.sh script in location /usr/lib/zabbix/alertscripts

vi sns.sh

Add the following lines in the script, replace your access key, secret key, and region.

if [ $# -eq 2 ]; then
    AWS_ACCESS_KEY_ID="AKIAnnnnnnnnnnnnnn" \
    AWS_SECRET_ACCESS_KEY="MySecretKeyHere" \
    AWS_DEFAULT_REGION="eu-west-1" \
    /bin/aws sns publish --phone-number "${1}" --message "${2}"
else
    /bin/echo -e "\nThis script requires 2 parameters."
    /bin/echo -e "\nUsage: ${0} PhoneNumberInE.194 Message\n"
    /bin/echo -e "\nUsage: ${0} +44nnnnnnnn 'My message here'\n"
fi

Apply execution permission to the file

chmod +x sns.sh

Now login to WEB UI of Zabbix server.

Go to Administration – Media types


Create a Media Type

Name: SNS
Type: script
Enter 2 parameters for the script
{ALERT.SENDTO}
{ALERT.MESSAGE}

Then Goto User- select user – add media

Type: SNS
send to: Add your mobile number including country code.
Severity: Select according to your need.

Make sure that AWS SNS support your Country.

that’s it now you have completed SMS alert configuration.
The user will receive the alerts via SMS in there any issues are triggered.

 

© 2018, Techrunnr. All rights reserved.

#1
#2
#3
Questions Answered
Articles Written
Overall Points

Related posts

3 Thoughts to “how to configure SMS in Zabbix using AWS SNS”

  1. zee

    Hi Prabhin, thanks for this tutorial. I’ve followed the steps but when i try to test the SNS service i get this msg
    usr/lib/zabbix/alertscripts/sns.sh: 2: /usr/lib/zabbix/alertscripts/sns.sh: /bin/aws: not found

  2. Zee

    Thanks for your swift response appreciated.. I’ve installed aws cli on ubuntu 18.04. after that i tried to run the SNS test again, however same error
    root@ip-10-0-1-154:~# aws –version
    aws-cli/1.14.44 Python/3.6.9 Linux/4.15.0-1057-aws botocore/1.8.48
    root@ip-10-0-1-154:~#

Leave a Reply