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

Use of initial_state and no change.

Post 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
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Use of initial_state and no change.

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

Re: Use of initial_state and no change.

Post 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?.
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Use of initial_state and no change.

Post 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
...
}
Former Nagios Employee
Locked