Steps to Use Nagios 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'll need to prepare PageGate's GetWeb module. To do so, have a look at this video tutorial:
https://www.notepage.net/videos/how-to-configure-web-interface.htm
Once you have GetWeb ready for the data, you'll need to do the following in Nagios:
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 defulat, /usr/local/nagios/libexec/
While you can name the script anything you like, we recommend giving it a straightforward name like smsalert.sh or pgsms.sh
--
#!/bin/bash
# set each part of the URL to send
UrlToCgi=$(printf "http://127.0.0.1/scripts/webgate.exe")
RecipientVar=$(printf "?USER=")
Recipient=$(printf "$2")
SenderVar=$(printf "&FRM=")
Sender=$(printf "fromme")
MessageVar=$(printf "&MSG=")
# set message to all the text sent on the command line
Message=$@
# url encode message text
Message=$(php -r "echo urlencode(\"$Message\");")
# build the request URL
FullUrl=$UrlToCgi$RecipientVar$Recipient$SenderVar$Sender$MessageVar$Message
# 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 'Sender' value from 'fromme' to the what you would like displayed as the 'sender'.
3) Next you'll need to define a free variable for your contacts or services.
3a) In the Contact Management section of a contact or service, select 'Misc Settings'
3b) Click 'Manage Free Variables'
3c) Define the name, which will be called on in the command, and its' value. We recommend using _recipient for the name and the value will be what Nagios passes to PageGate when this contact is messaged.
3d) The free variable called on changes depending on location.
If the free variable is under contacts, you would use '$_CONTACTRECIPIENT