Is this the best way to monitor deliberate status change

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
euphogeeza
Posts: 1
Joined: Fri Jul 20, 2012 4:15 pm

Is this the best way to monitor deliberate status change

Post 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
agriffin
Posts: 876
Joined: Mon May 09, 2011 9:36 am

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

Post 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.
Locked