Nagios sending notification to a script...
nemir nemiria
nemir at hotmail.com
Tue Apr 19 19:20:19 CEST 2005
Hi there.
Not sure this is gonna be a nagios thing, but there seem to be some bright
folk on this list and I am really stuck.
For ages now I have had Nagios 1.2 running great. I use gnokii to send out
sms alerts to multiple destinations via a simple shell script like this:
# 'nemir' contact definition
define contact{
contact_name nemir
alias Nemir Nemiria
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 notify-by-sms
email nemri at example.org
}
# 'notify-by-sms' command definition
define command{
command_name notify-by-sms
command_line /usr/local/nagios/send_sms "$NOTIFICATIONTYPE$ with
$SERVICEDESC$ at $HOSTADDRESS$ State: $SERVICESTATE$" && /usr/bin/printf
"%b" "Notification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost:
$HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time:
$DATETIME$\n\nAdditional Info:\n\n$OUTPUT$" | /usr/bin/mail -s "**
$NOTIFICATIONTYPE$ alert - $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **"
$CONTACTEMAIL$
}
# cat /usr/local/nagios/send_sms
for x in 6135551416
do
echo $1 | /usr/local/bin/gnokii --sendsms $x
sleep 10
done
echo `id -un` `date +%c` $x $1 >> /usr/local/nagios/logs
The plan is that it sends out an email to me and an sms to the everyone in
the team in case of an alert. I upgraded a couple of weeks back and now it
doesn't send this sms, though the email is functioning just fine.
I log in as nagios and use the script and it works perfectly. The logs
indicate that nagios sent the string to the script correctly (see below),
just for some reason when the nagios daemon sends the alert to the script it
deoesn't want to send the sms.
I cleared the log and then tripped the alerts by shutting down one of my DNS
services. Note that the last two lines are repeated with different times.
The first two sent no sms, the second was sent by me as the nagios user
using the same command as the nagios notification would have sent to the
script. You can see they produce exactly the same entry in the log, but
the command line use of the script successfully sends the sms.
nagios Wed 20 Apr 2005 01:56:04 EST 6135551416 PROBLEM with DNS at
202.138.213.100 State: CRITICAL
nagios Wed 20 Apr 2005 02:15:54 EST 6135551416 RECOVERY with DNS at
202.138.213.100 State: OK
nagios Wed 20 Apr 2005 02:18:02 EST 6135551416 RECOVERY with DNS at
202.138.213.100 State: OK
I can't think of how I can isolate this further.. And so I can't see what to
do next to try to resolve the porblem.
I'd love it if someone would help me out, or give some suggestions.
THanks!!
Nemir
-------------------------------------------------------
This SF.Net email is sponsored by: New Crystal Reports XI.
Version 11 adds new functionality designed to reduce time involved in
creating, integrating, and deploying reporting solutions. Free runtime info,
new features, or free trial, at: http://www.businessobjects.com/devxi/728
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list