How to deal with hosts that are not always on

Werner Flamme werner.flamme at ufz.de
Thu Aug 30 13:11:45 CEST 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Marc Haber [29.07.2012 10:51]:
> Hi,
> 
> I have a number of hosts that are not always turned on, such as my 
> Notebook, my home server (which sleeps if not used) and a number
> of test VMs. To get a reasonable volume of checks in my test
> installation of Nagios, I would like to have those machines
> monitored by it.
> 
> Obviously, I have notifications for those hosts turned off. This, 
> however, leads to non-zero numbers in the critical, warning and 
> unknown fields in the CGI, which gives a wrong impression of my
> health status since it is normal and expected that those
> hosts/services are down.
> 
> Is there any solution for this dilemma? Can I have Nagios monitor 
> hosts without reporting them as down when they are down?
> 
> I know this may sound strange, but I would like to have statistics 
> about how long the machines have been up and when.


Marc,

we use action handler scripts to schedule downtime in this case.

As an example, a downtime for a service is scheduled for 6 minutes if
$1 is CRITICAL and $2 is HARD. That is the maximum amount of time this
service needs to be restarted (via nrpe, in the same script):

/usr/bin/printf "[%lu]
SCHEDULE_SVC_DOWNTIME;host5.example.com;Host5;`date +%s`;$((`date +%s`
+ 6 * 60));1;0;0;serveradmin;Service on Host5 is restarted\n" `date
+%s` > /var/spool/nagios/nagios.cmd

Following
<http://old.nagios.org/developerinfo/externalcommands/commandlist.php>, you
can send the command DEL_SVC_DOWNTIME if the service is up before the
scheduled downtime ends.

The same should be possible with SCHEDULE_HOST_DOWNTIME or
SCHEDULE_HOST_SVC_DOWNTIME and DEL_HOST_DOWNTIME.

So Nagios will still see the downtime, but since it is marked as
scheduled downtime, your statistics may look better ;-)

HTH
Werner

- -- 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iEYEARECAAYFAlA/SnEACgkQk33Krq8b42NDRACaA1Gr5NS/FqWEWaP/qrb/ST6k
HocAni3ka4fC+tilNYBefzlz0IFAsDT7
=fZIL
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
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