Page 1 of 1

Use of initial_state and no change.

Posted: Mon Feb 08, 2016 5:54 pm
by ThomasJohansen
What do I do wrong when trying to use initial_state

I have a standby server ready to power up if necessary, normally it should not run, but I would like to get a warning if the server is powered up, my thought is using initial_state in the host definition, but not sure I can do that, since my test does not seems to work

Can I use this in the host definition, or is that not right at all

Code: Select all

        initial_state                   d
if not, is there a way to do reverse host okay status down = OK?... any ideas how to do it? Any help appreciated.

NagiosĀ® Coreā„¢ 4.1.1

Re: Use of initial_state and no change.

Posted: Mon Feb 08, 2016 6:02 pm
by rkennedy
You should be able to use the negate plugin for this (flips CRIT -> OK, OK -> CRIT).

See this document for more information (ignore the XI setup part, and look at the Troubleshooting section for an example).
https://assets.nagios.com/downloads/nag ... ios-XI.pdf.

Re: Use of initial_state and no change.

Posted: Mon Feb 08, 2016 6:10 pm
by ThomasJohansen
rkennedy wrote:You should be able to use the negate plugin for this (flips CRIT -> OK, OK -> CRIT).

See this document for more information (ignore the XI setup part, and look at the Troubleshooting section for an example).
https://assets.nagios.com/downloads/nag ... ios-XI.pdf.
But isn't that only used for services, or could that also be used for Host definitions?

I do have looked at it, but didn't understand how to set it up for host.

I have set this up in commands.cfg
# Check Reverse Check
define command {
command_name negate_check
command_line $USER1$/negate $USER1$/$ARG1$ $ARG2$
}

define command {
command_name negate_port_status
command_line $USER1$/negate $USER1$/check_ifoperstatus -H $HOSTADDRESS$ -C $ARG1$ -k $ARG2$
}

But how will the host definition look like?.

Re: Use of initial_state and no change.

Posted: Tue Feb 09, 2016 10:10 am
by rkennedy
You can change your check command on a host as well. Here's what you'd add to your host definition.

Code: Select all

define host {
...
check_command negate_port_status!arg2value
...
}