free international sms
NotePage Logo
Text Messaging Software
Order Text Messaging Software

Download Text Messaging Software

Integrate Text Messaging

  how to integrate?
  steps to integrate
  steps to integrate with delivery services
  why integrate?
  Integration benefits
  direct database Integration
  integration directory

Text Messaging Software Solutions

Text Messaging Tech Support

Text Messaging Resellers

Text Messaging Press Releases

 

SMS and Text Messaging Software Background

Integration with Nagios Server Monitoring Utility

Integrating Nagios with PageGate

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:
https://www.notepage.net/videos/how-to-configure-web-interface.htm

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
--
#!/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 "pageyou")
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 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 
define command{ 
command_name notify-service-by-sms 
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 
define command{ 
command_name notify-host-by-sms 
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:
:wq

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:
service_notification_commands notify-service-by-sms 
host_notification_commands notify-host-by-sms

8) Hit Escape on your keyboard and type the following to save the file:
:wq

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.

 


Return to How to Integrate


Copyright 1996-2020 NotePage, Inc. Privacy Policy
View Mobile Version NotePage.net
sales@notepage.net