Nagios not triggering one notification but another?
Schmitz, Carsten
Carsten.Schmitz at aegon.com
Mon Jan 10 12:37:12 CET 2005
Hi fellow Nagios users,
I have a problem thats driving me insane - its probably a tiny thing I'm overlooking and maybe someone can point me into the right direction.
We have an installation of Nagios 1.2 monitoring ~30 servers and lots of services. I had setup SMS notification in the past via an email-to-sms provider and that worked fine.
Now we have purchased an GPRS modem to send our own SMS. I have a shell script that can send SMS, and I'm trying to get Nagios to trigger it. However, nothing happens. Therefore, I tried to simplify the setup for easy debugging, and it seems that one notification just isn't triggered while another one is.
This is my test setup (showing relevant excerpts from the config files below):
services.cfg:
define service{
use generic-service ; Name of service template to use
host_name nemesis
service_description Internal Diagnostics
is_volatile 0
check_period 24x7
max_check_attempts 1
normal_check_interval 1
retry_check_interval 1
contact_groups sms_test
notification_interval 2400
notification_period 24x7
notification_options c,r
check_command diag
}
contactgroups.cfg:
define contactgroup{
contactgroup_name sms_test
alias SMS Test
members sms_carsten
}
contacts.cfg:
define contact{
contact_name sms_carsten
alias Carsten Schmitz - SMS MDM
service_notification_period 24x7
host_notification_period 24x7
service_notification_options c,r
host_notification_options d,u,r
service_notification_commands diag_out,notify-by-sms-mdm
host_notification_commands host-notify-by-sms-mdm
email devnull at mydomain.com
pager my_cellular_number
}
(note: my_cellular_number is of course a placeholder, it has my real numeric number in the actual file)
misccommands.cfg:
define command{
command_name notify-by-sms-mdm
command_line /usr/local/nagios/libexec/alert_sms_mdm $CONTACTPAGER$ "$SERVICEDESC$\n$HOSTNAME$ - $HOSTALIAS$\n$HOSTADDRESS$\n$SERVICESTATE$\n$OUTPUT$\n$DATETIME$"
}
define command{
command_name diag_out
command_line echo $CONTACTPAGER$ "$SERVICEDESC$\n$HOSTNAME$ - $HOSTALIAS$\n$HOSTADDRESS$\n$SERVICESTATE$\n$OUTPUT$\n$DATETIME$" > /tmp/nagios_diag_out.out
}
"diag" is just a dummy script that exits with return code 0 or 1 at my liking, so that I can easily trigger a Nagios alert. It also writes a log file.
"/usr/local/nagios/libexec/alert_sms_mdm" is the SMS script that also writes a log file.
"diag_out" just writes a file in /tmp for seeing if Nagios triggers a notification, and for seeing what the output after variable expansion looks like.
I have "reloaded" nagios and the config check went just fine.
What works:
I can see in the "diag" log file that the check itself is being triggered by nagios.
I can see in /tmp/nagios_diag_out.out that the "diag_out" misccommand (first notification) has been run
I can take the output from Nagios from the /tmp/nagios_diag_out.out file (same as the output for "notify-by-sms-mdm" would be) and pass it on the shell to the SMS script and I get an SMS (and a log file entry that notify-by-sms-mdm has been run).
What fails:
I do not receive an SMS (or a log file entry saying that it called notify-by-sms-mdm) when the Nagios alert is triggered.
I'm sure this is not a bug but me overlooking a tiny detail somewhere ... if someone among the fellow Nagios using community spots the problem, I'd be very grateful for a hint.
Thanks!
Carsten Schmitz
-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
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