You can use Zabbix to generate alarms and send sms and email notifications to you or your users. In this post I am going to configure Zabbix SMS and email notification.
In Zabbix Server Configuration file, find AlertScriptsPath.
nano /etc/zabbix/ zabbix_server.conf
AlertScriptsPath in my config file is as follows. So, we need to place my sms script in to that path (/usr/lib/zabbix/alertscripts)
After you copy your sms scripts (I have 2 files) into the alertscriptspath. Make sure the script is execute by running the following code.
sudo chmod 755 sms_from_mesaj160.py.save
sudo chmod 755 sms_from_mesaj160.php
Then on Zabbix Web Admin console, Administration > Media Types> Edit SMS as follows
Also Edit Email media type as follows to receive email notifications
Now we need to add contact information (sms and email address) to our users. Administration > Users> Select a User > Media and add media info for email and sms.
Now we need to tell Zabbix under what conditions it should send notification to us.
Configuration> Actions > Under the Actions Tab> Add 2 New Conditions like below
click on Operations Tab and select users who will receive the notification and choose from which media they will receive the notifications
You can see if notifications are sent successfully or some errors occurredduring the delivery from Monitoring > Problems > Click on Time.
I received some errors about SOAP client. I checked phpinfo and saw that soap client was not installed. I installed soap client by running the following commands.
sudo apt-get install php7.2-soap
sudo systemctl restart apache2
Now emails and SMS are sent succesfully
Zabbix is notifying us when a problem arises. We also want to be notified whenever that a problem is resolved. Configuration > Actions > Recovery Operations Tab > Add Users to be notified and click Update button to save
As you see, I can receive both problem and resolved notifications now