Using an SMS Server to Provide a Robust Alerting Service for Nagios
I was able to get everything running in a day or two, but I did have to resolve several issues as part of the installation. I also discovered several problems that required changes to the Perl script. Therefore, it's important to test the scripts.
You can run the check_smsfinder.pl and sendsms.pl scripts on the command line to view their output directly. For example:
% /usr/local/nagios/libexec/check_smsfinder.pl \
-H 192.168.1.50 -u nagios -p secret
OK: GSM signal strength is 100.0% - \
model: SF100-G - \
firmware: 1.31|loginID=1607132337 strength=100.0%;40;20;;
% /usr/local/nagios/smsack/sendsms.pl \
--noma -H 192.168.1.50 -u nagios -p secret \
-n 14155551212 -m 'this is a SMS from nagios'
"this%20is%20a%20SMS%20from%20nagios" to 14155551212 \
via 192.168.1.50 send successfully. MessageID: 37
The smsack.cgi script is a little harder to debug than the command-line scripts, but the usual Apache log files access_log and error_log are useful in that they will contain the HTTP response codes when the CGI is invoked by the iSMS. You also can use the method described below under “Network Capture” to look for problems with the CGI script.
In many places within Nagios, the Perl script and the iSMS device contain debugging information. Knowing where those are will help you with your installation.
The iSMS can send helpful debugging messages to a remote host via syslog. The Nagios server would be an ideal destination for the messages, as all logging can be consolidated in once place. The remote syslog host is specified in the iSMS Web GUI. The iSMS syslog messages use the LOG_LOCAL0 facility. I added a local0.* /var/log/isms entry to my /etc/syslog.conf file to capture all messages. The log file will record all SMS messages sent and received by the iSMS, for example:
Nov 23 09:27:59 smsgw MultiModemiSMS modem: sentlog:
[SENT TO] : 14155551212 : [MSG] : this is a SMS from Nagios
The log also contains any authentication failures. This is useful because the check_smsfinder.pl and sendsms.pl scripts authenticate themselves to the iSMS every time they run.
The iSMS has a concept of an “Inbox” for SMS messages received from mobile users and an “Outbox” for SMS messages being sent out from the iSMS. You can examine these boxes via the iSMS Web interface to find out whether a message actually was received or transmitted.
Nagios logs to the file nagios.log, which is typically found in the /usr/local/nagios/var directory. You can use this log to verify that Nagios is generating an alert for a problem and that a command has been used to send an SMS (notify-host-by-sms):
[1258664139] HOST NOTIFICATION:
epearce-sms;mailserv2;DOWN;notify-host-by-sms;CRITICAL -
Host Unreachable (192.168.1.250)
The Nagios log also will show the results of smsack.cgi running after getting the “ACK” back from a mobile user:
[1258500602] EXTERNAL COMMAND:
ACKNOWLEDGE_HOST_PROBLEM;mailserv2;1;1;1;14155551212;
Acknowledged by 14155551212 at 09/11/17 15:29:57
ACK PROBLEM mailserv2> is DOWN /11-17-2009 15:28:21/ CRITICAL -
Host Unreachable(192.168.1.250)
The smsfinder scripts log to smsfinder.log (also in the Nagios var directory). This file will contain debugging information for the sendsms.pl and smsack.cgi uses of the script. The lines containing “SMSsend” show the status of sendsms.pl when it is being run by Nagios. For example:
2009/11/19 12:55:39 SMSsend:
"PROBLEM...mailserv...is...DOWN...CRITICAL..."
to 14155551212 via 192.168.1.250 queued successfully.
MessageID: 14
Lines containing “SMSreceived” and “SMSverify” will show the progress in parsing any acknowledgement SMS messages received by the smsack.cgi script:
2009/11/12 09:15:41 SMSreceived:
username=nagios&password=secret&XMLDATA=
<?xml version="1.0" encoding="ISO-8859-1"?>
<Message Notification>
<SenderNumber>14155551212</SenderNumber>
<Message>
ACK PROBLEM HostAlert mailserv2 192.168.1.250
/AllServices is DOWN
/11-12-2009 09:11:46/ CRITICAL -
Host Unreachable (192.168.1.250)
</Message>
<Date>09/11/12</Date>
<Time>09:15:36</Time>
</Message Notification>
2009/11/12 09:15:41 SMSverify
status = ACKed - ACCEPTED:
From=14155551212 Received=09/11/12 09:15:36
Status=ACK Host=mailserv2 Service=AllServices
MSG="ACK PROBLEM ... Host Unreachable (192.168.1.250)"
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?
| Designing Electronics with Linux | May 22, 2013 |
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
- RSS Feeds
- Dynamic DNS—an Object Lesson in Problem Solving
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Designing Electronics with Linux
- Using Salt Stack and Vagrant for Drupal Development
- New Products
- A Topic for Discussion - Open Source Feature-Richness?
- Drupal Is a Framework: Why Everyone Needs to Understand This
- Validate an E-Mail Address with PHP, the Right Way
- What's the tweeting protocol?




5 hours 12 min ago
9 hours 39 min ago
13 hours 14 min ago
13 hours 47 min ago
16 hours 10 min ago
16 hours 13 min ago
16 hours 15 min ago
20 hours 40 min ago
22 hours 31 min ago
1 day 3 hours ago