Acknowledge downed host with all associated services?


#1

Hi,

Today I tried to acknowledge a problem for the first time (we usually just let them stay unacknowledged until solved) and faced an annoying situation. I’m guessing I’ve just done something wrong, but my skills with google failed to come up with an answer to my question.

The host that went down has 10 or so monitored services, when the host went down naturally all services on it went as well. I logged in to Nagios and acknowledged the host, but that did’nt acknowledge the services. I looked for a link similar to ‘acknowledge all services on host’ but failed to locate such a link.

Eventually I ended up acknowledging all services by hand, and that really annoyed me. What did I do wrong?

Sincerely,
Mattias


#2

Hey,

You didn’t do anything wrong. Nagios won’t auto-acknowlege services associated with a host as it wouldn’t make sense to do so in many situations.

So, instead of using acknowlege, set host downtime for that host and it will stop bothering you about the services it has. Otherwise, you have to go through each one.

If you really really want to go through each one, your best bet would be to learn the nagios external command for acknowledge (first link):
nagios.org/developerinfo/ext … ndlist.php
then do a loop:
#!/bin/bash
now=date +%s
commandfile=’/usr/local/nagios/var/rw/nagios.cmd’

for service in “check one” “check two” “check three” ; do
/bin/printf “%lu] ACKNOWLEDGE_SVC_PROBLEM;host1;$service;1;1;1;Some One;Some Acknowledgement Comment\n” $now > $commandfile
done

I would actually just copy+paste the service names from the web browser, throw them in a text file (line by line) and change my for loop to:
for service in cat servicelist.txt; do


#3

Thank you for a very good answer!

The thing about acknowledge is that that flag will be automatically reset whenever the status of the problem changes, which is alot better then scheduling downtime when you don’t know how long the machine will be down, or better than disabling notifications as one will more likely than not forget to enable them again once the problem is solved.

In my case I am the only of a few administrators who can actually use the shell on the nagios server, so I’ll have to fix a link in the web interface for it to be useful.

I guess I’ll have to read up on my PHP and hack away. :wink:

Thanks again for a really good answer though!