Friday, May 23. 2008Nagios 2-way alerting via SMS - Part 2Comments
Display comments as
(Linear | Threaded)
Excellent posts, very useful and informative. Thanks for posting - looking forward to part three!
Very good tutorial, but Nagios don't send SMS yet
When you say "I call this script /usr/local/bin/sendsms.sh" why in the command line definition you refer to other path, it was a mistake? command_line /usr/local/nagios/sendsms.sh host And another thing. I found a easy way to test the notifications just starting and stopping the ssh service, so I just added to in my localhost.cfg to my SSH service description this : contact_groups admins-sms notifications_enabled 1 But I don't receive any SMS
I keep getting "SendingError" under the Status Field in my smsd databases' "sentsms" table. My smsd database's "outbox" table gets populated as per normal and my "sentsms" table follows suit afterward but "SendingError" keeps appearing under the Status Field.
I'm using Ubuntu Server 8.04 LTS with Gammu version 1.18.90. My server is connected via serial port to a Siemens MC35i. I think I am 95% successful, but I can't figure out why I keep on getting a SendingError. I can send an sms successfully using: # echo "Test message" | gammu --sendsms TEXT . Any ideas? Anyone?
Hmm...
Take a look and the sendsms.sh The line to do the sending is:
Have you configured up items like the /etc/smsdrc, /etc/gammu and the $NAGIOS_CONTACTPAGER for each person? Also refer to the upstart information.. you need the SMSd to be running to be able to send via this method. (so it logs correctly).
Hi Matt,
Thanks for your reply! Appreciate it. My /etc/smsdrc and /etc/gammu files are below: /etc/smsdrc [smsd] PIN = 1234 commtimeout = 1 sendtimeout = 10 # ------------------------- SETTINGS FOR --smsd MYSQL --------------------------- user = gammu password = password pc = localhost database = smsd ------EOF------- /etc/gammurc [gammu] port = /dev/ttyS0 connection = at19200 startinfo = no name=Siemens MC35i synchronizetime = no use_locking = no ------EOF---------- My commands.cfg: ---------------------- # 'host-notify-by-sms' command definition define command { command_name host-notify-by-sms command_line /usr/local/bin/sendsms.sh host } # 'notify-by-sms' command definition define command { command_name notify-by-sms command_line /usr/local/bin/sendsms.sh service } My contacts.cfg: ------------------- define contact{ contact_name joe alias joe daniels service_notification_period 24x7 host_notification_period 24x7 service_notification_options w,u,c,r host_notification_options d,u,r service_notification_commands notify-by-sms host_notification_commands host-notify-by-sms pager + } define contactgroup{ contactgroup_name admins-sms alias Administrators who receive SMS Alerts members joe } My routers.cfg: ----------------- # Define the router/switch that we'll be monitoring define host{ use routers ; Inherit default values from a template host_name edge-gw1 ; The name we're giving to this router/switch alias PrimaryRouter ; A longer name associated with the router/switch address 192.168.1.4 ; IP address of the router/switch hostgroups edge_routers ; Host groups this router/switch is associated with check_command check-host-alive max_check_attempts 20 check_period 24x7 contact_groups admins-sms # Create a new hostgroup for Edge routers define hostgroup{ hostgroup_name edge_routers ; The name of the hostgroup alias Edge Routers ; Long name of the group } # Service to PING Edge Routers define service{ use generic-service ; Inherit values from a template hostgroup_name edge_routers service_description PING ; The service description contact_groups admins-sms check_command check_ping!200.0,20%!600.0,60% ; The command used to monitor the service normal_check_interval 5 ; Check the service every 5 minutes under normal conditions retry_check_interval 1 ; Re-check the service every minute until its final/hard state is determined } Hope the above helps. Rgds, Smiley
Any further helpful pointers from anyone is much appreciated in advance. Kinda desperate to get things working. Stumped at the moment.
Smiley
So i follow your rules to configure Nagios 2-way alerting via SMS. I did Step 1: Plugging in my GSM source. So it works fine. Next Step 2: Setting up my database (i did that). Step 3: Configure gammu (works fine . I can send sms) . Step 4: Configure the SMS Daemon (works fine too it drop my sms into database). Step 5: Configure Nagios. (Nagios configured) drops :
1. ..... 2. Checking for circular paths between hosts... 3. Checking for circular host and service dependencies... 4. Checking global event handlers... 5. Checking obsessive compulsive processor commands... 6. Checking misc settings... 7. 8. Total Warnings: 0 9. Total Errors: 0 10. 11. Things look okay - No serious problems were detected during the pre-flight check But it doesn't send me sms when alert is... Maybe this script is bad : script /usr/local/bin/sendsms.sh. ... I can't understand there problem is. I'm on FREEBSD 7.2 OS. Gammu is newest version and Nagios so on.
I only want to send alert sms from nagios no need for taking messages, do i still need a db?
The DB retains them for historical purposes.
And no you don't need to store them in the DB if you don't want to.
Heh,
Great articles Matt. They were inspiring to me. With your help I managed to make SMS alerts work. The only unsuccess I had was with the Sms Daemon. When I start smsd.sh it will throw: Starting communication Error getting SMS status (Unknown response from phone.) although when using only gammu, everything seems to work. Should this be the Phone (Motorola C650) not supporting something? Because I really wanted to go on with replying Nagios. Do you recommend any workarounds? Cheers, Alex.
Hi Alex,
Thank you for your kind words! I'm glad you've found the posts inspiring and useful. Do you have any messages in the log files? Ensure that smsd uses similar command line arguments that works with your phone as you used on the command line. Hopefully that works.
Ok, I managed to make it work. I grabbed the latest version of gammu and compiled it, and it works like a charm. Only minor modifications to your script, like instead of "gammu sendsmsdsms" it's "gammu-smsd-inject", it has separate binaries now, and a different database schema for mysql.
Also it took me a while to understand why nagios wouldn't send sms - (a heads up for beginners), I "su" to user nagios and tried to send a sms and it would refuse to do so because of permissions on the log file. Chmod did the trick. Now on to the third part of your tutorial! Cheers!
Hi Matt,
I configured everything as instructed but I'm not able to send sms alerts from nagios.I did chmod logfile & I can see the message generated in logfile , but its not sending sms. I have done changes in "sendsms.sh" as follows echo -e $MESSAGE | gammu-smsd-inject TEXT $NAGIOS_CONTACTPAGER I ran above command on command line as a nagios user & it worked fine.SMS was delivered . Can u please elloborate more to fix this issue. |
QuicksearchCalendar
My PhotosWhat I've been listening toWe Want More by The Living End on Tue 31 Aug 2010, 03:00:43 PM Headmaster Ritual by Radiohead on Tue 31 Aug 2010, 02:55:50 PM The Beauty Of Gray by Live on Tue 31 Aug 2010, 02:51:34 PM Don't Panic by Coldplay on Tue 31 Aug 2010, 02:49:18 PM Hold Tight London (feat Anna-Lynne Williams) by The Chemical Brothers on Tue 31 Aug 2010, 02:43:18 PM Cantaloupe Island by Kai Winding on Tue 31 Aug 2010, 02:37:33 PM Twosome (Marta et Katalin version) by Deep Forest on Tue 31 Aug 2010, 02:33:25 PM The Big Jump by The Chemical Brothers on Tue 31 Aug 2010, 02:28:41 PM Key to the Highway by Derek and the Dominos on Tue 31 Aug 2010, 02:22:14 PM Isolate by Moby on Tue 31 Aug 2010, 02:18:46 PM Fri 3 Sep 2010, 09:32:49 AM
Recently BookmarkedBlog StatsLast entry: 2010-07-25 10:10
278 entries written
493 comments have been made
Blog Tags accounting advertising alerting apps asterisk australia birthday building coding cricket email entertainment failure family firefox football friends gnome google government hardware health holiday house humour Internet ISP java life linksys Linux marriage microsoft mistake monitoring movies mozilla nagios networking news office openoffice open source opinion oss pets phone photo play politics power relax respect review security shopping sms snom snoring society software spam sport support sysadmin technology telephony tennis terrorism tv twitter ups virtualbox virtualization voip web weekend wildlife windows wine wireless workLicense |
|||||||||||||||||||||||||||||||||||||||||||||||||
This is a 3 part posting that covers how you can setup 2-way Nagios alerting via SMS. The series is broken down as such: Part 1: Background and Requirements (this article)Part 2: Sending SMS messages from NagiosPart 3: Acknowledging SMS messages For
Tracked: May 23, 01:29
This is a 3 part posting that covers how you can setup 2-way Nagios alerting via SMS. The series is broken down as such: Part 1: Background and RequirementsPart 2: Sending SMS messages from NagiosPart 3: Acknowledging SMS messages (this article) Rev
Tracked: May 24, 02:57