Integrating Nagios with
Steps to Send Text and SMS Messages from Nagios
Follow these steps to use Nagios Server Monitoring with PageGate
PageGate can be easily integrated with Nagios by having Nagios submit alerts and notifications to PageGate's GetWeb interface. Before you configure things in Nagios, you will need to prepare PageGate's GetWeb interface. To do so, have a look at this video tutorial:
Once you have GetWeb ready for the data, you'll need to:
1) Create a Linux shell that submits the monitored information to PageGate's web service and place that file in the 'libexec' folder contained in the Nagios directory. By default, /usr/local/nagios/libexec/
While you can name the script anything you like, we recommend giving it a straightforward name like smsalert.sh
# set each part of the URL to send
# set message to all the text sent on the command line
# url encode message text
Message=$(php -r "echo urlencode(\"$Message\");")
# build the request URL
# send the request
wget -O- "$FullUrl"
2a) In the above script, be sure to update the UrlToCgi value to the hostname or IP of the system hosting GetWeb.
2b) Update the Recipient value from 'pageyou' to the name of the recipient or group that should receive the alerts/notifications.
2c) Update the 'Sender' value from 'fromme' to the what you would like displayed as the 'sender'.
3) Once the .sh file is in place, open 'commands.cfg' with the 'vi' editor.
Command: vi /usr/local/nagios/etc/objects/commands.cfg
4) Find the 'notify-host-by-email' section and insert this after that section:
# 'notify-service-by-sms' command definition
command_line /usr/local/nagios/libexec/smsalert.sh "--PageGate Service Alert-- Host: $HOSTNAME$, State: $HOSTSTATE$ Service $SERVICEDESC$ Description: $SERVICESTATE$ Time: $LONGDATETIME$"
# 'notify-host-by-sms' command definition
command_line /usr/local/nagios/libexec/smsalert.sh "--PageGate Host Alert-- Host: $HOSTNAME$, State: $HOSTSTATE$, Time: $LONGDATETIME$"
5) Hit Escape on your keyboard and type the following to save the file:
6) Open 'contacts.cfg' with the 'vi' editor.
Command: vi /usr/local/nagios/etc/objects/contacts.cfg
7) Insert the following before the 'email' section:
8) Hit Escape on your keyboard and type the following to save the file:
9) Restart the Nagios service to have the changes take effect.
Command: service nagios restart
After Nagios has restarted, you can log in to the Nagios web utility to verify that alerts are being sent.