When the Google Calendar had the opportunity to receive free SMS notifications, I think all the developers thought that this could be screwed to their scripts. Many have not found the time and effort to do this, so I provide a PHP script for sending free SMS to myself, and for greater advantage I will screw it to the Zabbix monitoring system. I hope after these words, all system administrators have thought about how great it will be to receive SMS when a server drops out of the network, someone steps on the network wire, the router reboots or the temperature in the server room rises.
Zabbix version
This version is intended for SMS notification when an event occurs by triggering. Zabbix allows you to customize filtering by importance (for example, it will not send informational events).
1.Google Account Setup
Go to Calendar > Settings> Settings for mobile devices.
Specify your phone number, confirm by receiving a test SMS.
2. Install and configure the script
Connect to Zabbix server via SSH or WinSCP.
Locate the alertscripts folder from the possible options:
I recommend putting the group and the “zabbix” ovner and rights 0755 on all the contents.
In the file zabbix_fsms.php indicate:
time zone
place (optional)
phone number
username and password from Gmail.com
Please note that for each recipient you need to create your own case with parameters.
To check, you can execute the script console: / usr / local / share / zabbix / alertscripts / zabbix_fsms 795112345678 Console Test Ok Where 795112345678 is your phone number, and / usr / local / share / zabbix / alertscripts / is the path you found in the second step to alertscripts. As a result, SMS should come.
3. Configure Zabbix
In Zabbix, go to Administration> Media types> Create media type.
Specify click Save.
Go to Profile> Media> Add.
Specify Type: FSMS; SendTo: your mobile number; When active and Use if severity to taste.
Setup complete! To test, you can turn off a pair of routers to create a trigger that will work in a minute, for example, "{hostname: agent.ping.nodata (1m)} = 0".
Version for Web Developers
Difference from Zabbix version: used as a regular script, not a console, the code is combed for developers. http://mamaev.pro/zabbix/fsms_webdev.zip [5.8 MB] The script is developed using the Zend Framework. Attention, this is my first article, I accept all comments with pleasure. UPD: The user br0ziliy uses Python to implement free SMS via Google Calendar, we look at SMS notifications from Nagios with little blood .