Howto - Server down = OK ?

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
ThomasJohansen
Posts: 13
Joined: Wed Dec 30, 2015 6:47 am

Howto - Server down = OK ?

Post by ThomasJohansen »

Is there a way (tips or trick) to have a reverse server monitoring.

We have some servers there normally should be shutdown, and only online on request. Is there a way to have a reverse server monitoring, where OK is equal Shutdown, and CRITICAL equal Online?
User avatar
rhassing
Posts: 416
Joined: Sat Oct 05, 2013 10:29 pm
Location: Netherlands

Re: Howto - Server down = OK ?

Post by rhassing »

You can use negate.
The script negate negates the status of a plugin (returns OK for CRITICAL and vice-versa).
Additional switches can be used to control which state becomes what.
Rob Hassing
Image
ThomasJohansen
Posts: 13
Joined: Wed Dec 30, 2015 6:47 am

Re: Howto - Server down = OK ?

Post by ThomasJohansen »

Thank you, I haven't figured out how that one works, it's a bit tricky too figure out. Need to try several settings

Any surgestion how command.cfg, and define host{ looks like when using negate?

negate location: /use/local/nagios/libexec/

lets say server is called beta007 and is FQDN on mylan.dk (beta007.mylan.dk)
User avatar
rhassing
Posts: 416
Joined: Sat Oct 05, 2013 10:29 pm
Location: Netherlands

Re: Howto - Server down = OK ?

Post by rhassing »

Code: Select all

define command {
command_name negate_host_status
command_line $USER1$/negate $USER1$/check_ping -H $HOSTADDRESS$ -w $ARG1$ -c $ARG2$ -p 5
register 1
}
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
Rob Hassing
Image
ThomasJohansen
Posts: 13
Joined: Wed Dec 30, 2015 6:47 am

Re: Howto - Server down = OK ?

Post by ThomasJohansen »

rhassing that did the trick... Thank you very much. :D
ThomasJohansen
Posts: 13
Joined: Wed Dec 30, 2015 6:47 am

Re: Howto - Server down = OK ?

Post by ThomasJohansen »

I'm trying to work with negate, and the alerts now working. but is it possible to change the Status text to be correct. in my case it say up when it is down and equal OK, but what I would like to is

text 'Down' equal OK (green)
text 'UP' equal CRITICAL (red)
User avatar
rhassing
Posts: 416
Joined: Sat Oct 05, 2013 10:29 pm
Location: Netherlands

Re: Howto - Server down = OK ?

Post by rhassing »

There are some examples on: https://xteams.oit.ncsu.edu/iso/node/831
Rob Hassing
Image
Locked