Try something like this:

#!/bin/sh

RETURN_STATUS=`/usr/local/nagios/libexec/check_nrpe -H <primary_host> -c check_nagios | awk -F: '{ print $1 }' | awk '{ print $2 }'`
if [ $RETURN_STATUS != "OK" ]; then
sed -i 's/enable_notifications=0/enable_notifications=1/' /usr/local/nagios/etc/nagios.cfg sed -i 's/execute_service_checks=0/execute_service_checks=1/' /usr/local/nagios/etc/nagios.cfg
else
sed -i 's/enable_notifications=1/enable_notifications=0/' /usr/local/nagios/etc/nagios.cfg sed -i 's/execute_service_checks=1/execute_service_checks=0/' /usr/local/nagios/etc/nagios.cfg
fi
sudo /etc/init.d/nagios reload

Note: you must add nagios user to sudoers group (without password prompt).


On 08/16/2010 02:44 PM, [email protected] wrote:

Hi,

Even I run Nagios on Virtual machines.

Please let me know where can I get the support for running cron job on my secondary Nagios server to monitor the Nagios service on primary Nagios server?

Thanks,

Ravi G

*From:* Chris Beattie [mailto:[email protected]]
*Sent:* Monday, August 16, 2010 6:51 PM
*To:* Nagios Users List
*Subject:* Re: [Nagios-users] Using two nagios servers...

Your servers will probably be fine servicing the extra Nagios polling, unless they are overloaded already.

Since I run Nagios on virtual machines, however, I tried to keep the load on my failover Nagios server minimized. My failover Nagios server runs a cron job that uses the check_nagios plugin to monitor the state of the primary Nagios server. If the primary server is up and running, the failover server will just rsync the state and configuration files from the primary. If the primary server becomes unavailable, the cron job will start the Nagios service on the failover server and keep it running until it detects the primary has recovered.

*From:* [email protected] [mailto:[email protected]]
*Sent:* Monday, August 16, 2010 7:45 AM
*To:* [email protected]
*Subject:* [Nagios-users] Using two nagios servers...

Hi All,

I am planning to configure all the servers in my client environment in two Nagios servers(in two different locations) in order to create Back up.

Please let me know whether there will be any overload on the servers as two Nagios servers will be polling them.

Thanks,

Ravi G


------------------------------------------------------------------------------
This SF.net email is sponsored by

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev


_______________________________________________
Nagios-users mailing list
[email protected]
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
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Nagios-users mailing list
[email protected]
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

Reply via email to