Page 1 of 1

Is this the best way to monitor deliberate status change

Posted: Mon Jul 30, 2012 5:34 am
by euphogeeza
Hi

I'm new to Nagios monitoring and am wondering if I am wanting to do something that is not do-able.

QUESTION
=========
Is there a better way of doing this so that...
I only have one service listed in the table where during office hours its reporting OK if the proxy server is UP and
I only have one service listed in the table where during NONT office hours it os reporting OK if the proxy server is DOWN

Situation
========
I have a proxy server running on a virtual machine.
I only want our proxy UP during office hours so I have scheduled the vm to be shutdown at the end of office hours.
All works well.

Requirements
============
What I would like to do is make nagios check:
1 - proxy server vm is UP during office hours (notifying if it is down)
2 - proxy server vm is DOWN out of office hours (notifying if it is up)

Current Solution
==============
I have defined the two timeperiods OffHrs and NonOffHrs in /etc/nagios3/timeperiods.cfg

My host definition is

define host{
use generic-host
host_name myproxy
check_period 24x7
notification_period 24x7
}

.. and I have defined TWO services ..

define service{
use generic-service
host_name myproxy
service_description OfficeHrs - VM should be UP
check_period 24x7
notification_period OffHrs
check_command check-kvm-guest-up!myproxy
}

define service{
use generic-service
host_name myproxy
service_description NonOfficeHrs - VM should be DOWN
check_period 24x7
notification_period NonOffHrs
check_command check-kvm-guest-down!myproxy
}

Results
=======
HOST SERVICE STATUS STATUS INFORMATION
----------------------------------------------------------------------------------------------------------------
myproxy NonOfficeHrs - VM should be DOWN CRITICAL [ ... ] Domain 'myproxy' is UP
OfficeHrs - VM should be UP OK [ ... ] Domain 'myproxy' is UP


Kind Regards

Ritchie

Re: Is this the best way to monitor deliberate status change

Posted: Mon Jul 30, 2012 10:43 am
by agriffin
Yes, this is how you would do it if you are concerned about the proxy being up during non-office hours. If you don't care whether the proxy server is up or down during non-office hours you could just have one check and set the check period to your office hours.