re-enable all notifications on hosts & services

Chris Beattie cbeattie at geninfo.com
Tue Dec 28 00:25:49 CET 2010


Mark A. Lappin wrote:
> interface for hosts and all services on hosts.  Dozens it seems.  Is 
> there an easy way to turn all notifications back on for all services and 
> all hosts in one fell swoop?  We had a lot of htem turned off while we 

You can use Nagios' external commands to do that.

http://old.nagios.org/developerinfo/externalcommands/commandlist.php

If I didn't have to be too careful, I'd do something like this 
(apologies for the line wrapping):

#!/bin/sh

now=`date +%s`
commandfile='/usr/local/nagios/var/rw/nagios.cmd'
statusfile='/usr/local/nagios/var/status.dat'

for i in `grep host_name $statusfile | sort --unique | sed 
"s/\thost_name=//"`
do
	/bin/printf "[%lu] ENABLE_HOST_NOTIFICATIONS;$i\n" $now > $commandfile
	/bin/printf "[%lu] ENABLE_HOST_SVC_NOTIFICATIONS;$i\n" $now > $commandfile
done

Nothing in this message is intended to make or accept an offer or to form a contract, except that an attachment that is an image of a contract bearing the signature of an officer of our company may be or become a contract. This message (including any attachments) is intended only for the use of the individual or entity to whom it is addressed. It may contain information that is non-public, proprietary, privileged, confidential, and exempt from disclosure under applicable law or may constitute as attorney work product. If you are not the intended recipient, we hereby notify you that any use, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this message in error, please notify us immediately by telephone and delete this message immediately.
 

Thank you.


------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
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