Nagios + SMS = Triplicated SMS Messages?!

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
kristiaan_d
Posts: 3
Joined: Mon Mar 07, 2011 5:34 am

Nagios + SMS = Triplicated SMS Messages?!

Post by kristiaan_d »

Hi Everyone,
Firstly i am not sure what Config files you may need so if you let me know i can post them as needed to help resolve any problems i am getting.

So here go's - i have Nagios installed and three contacts setup to receive email messages when things go wrong within our network, I recently added a new Command to Nagios's command.cfg file this is designed to be called when ever a problem is found with a host or service

however our first test of the system caused it to generate three SMS messages per recipient, which did not seem to match the amount of emails that were sent for the error, i am guessing this is a problem within my config files but i have no real idea where to look regarding this as the email warnings are correct and each person only gets one message each.


Kris
kristiaan_d
Posts: 3
Joined: Mon Mar 07, 2011 5:34 am

Re: Nagios + SMS = Triplicated SMS Messages?!

Post by kristiaan_d »

Figured i would post an update to this question as it seems to have been viewed a lot but no help offered.

I am still getting the same problem does anyone have any suggestions?
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Nagios + SMS = Triplicated SMS Messages?!

Post by mguthrie »

Can you send the full command definitions that you created for sending the SMS messages? Also perhaps an example host or service config that calls this command?
kristiaan_d
Posts: 3
Joined: Mon Mar 07, 2011 5:34 am

Re: Nagios + SMS = Triplicated SMS Messages?!

Post by kristiaan_d »

Hi here is a copy of the command i created for the sms script, please be aware i have had to sanitise some usernames and password out of the list, also i have removed the domains on the email addresses to avoid spam :D

if you need any more info please let me know.

commands.cfg

Code: Select all

# 'notify-service-by-sms' command definition
define command{
	command_name	notify-service-by-sms
        command_line /home/<myuser>/test.sh "***** Nagios ***** Host: $HOSTALIAS$ State: $SERVICESTATE$ Service: $SERVICEDESC$ Additional Info: $SERVICEOUTPUT$"
	}

here is a copy of the test.sh file

Code: Select all

#!/bin/bash
url1="http://www.txtlocal.com/sendsmspost.php?uname=myusername&pword=password&message="

url2="$@"
url2=$(php -r "echo rawurlencode('$url2');")

finalurl=$url1\"$url2\""&from=SSLTXTALert&selectednums=1111,2222,3333"

wget --spider $finalurl
here is a copy of the contact.cfg file

Code: Select all

# CONTACTS

define contact{
        contact_name                    kris_davies		; Short name of user
	use				generic-contact		; Inherit default values from generic-contact template (defined above)
        service_notification_commands	notify-service-by-email
	alias                           Kristiaan Davies	; Full name of user
        email                           kristiaan.davies@mycompany	;
        }

define contact{
	contact_name			will_dearden		; short name of user
	use				generic-contact		; inherit default valuse from generic contact template
	service_notification_commands 	notify-service-by-email,notify-service-by-sms
	alias				William Dearden 	; full name of user
	email				william.dearden@mycompany  ;
	}

define contact{
	contact_name			david_balmforth		;short name of user
	use				generic-contact		;inherit default values
	alias				David Balmforth Home	;full username
	service_notification_commands	notify-service-by-email
	email				david.balmforth@mycompany	;
	service_notification_options	c,r
	host_notification_options	d,u,r
	}

# CONTACT GROUPS

# We only have one contact in this simple configuration file, so there is
# no need to create more than one contact group.

define contactgroup{
        contactgroup_name       admins
        alias                   Nagios Administrators
        members                 kris_davies, will_dearden, david_balmforth
        }


Locked