Page 1 of 1

Wrong Host State with dummy check

Posted: Wed Sep 04, 2019 7:40 am
by davide.galletti.75
Hi All,

I have a NagiosXI demo (free) edition for testing in our lab and stumbled upon a strange behavior.

I've created different dummy host with:
name: dummy xx
IP: 127.0.0.1
check_command: check_dummy

now for testing I'm passing to the check_command the params "1" and "the host is DOWN"
(check_dummy!1!"the host is DOWN")

but in nagios (tatical view or host, host problems etc) the host always shows up as "UP" (OK).

what am I missing ?

Thanks,
Davide

Re: Wrong Host State with dummy check

Posted: Wed Sep 04, 2019 8:51 am
by scottwilkerson
For hosts you want to pass 2 to check_dummy

Code: Select all

check_dummy!2!"the host is DOWN"

Re: Wrong Host State with dummy check

Posted: Wed Sep 04, 2019 10:39 am
by davide.galletti.75
Yes, that's right ... for UNREACHABLE .... but why is 1=DOWN not working ?

from docs i see:
$HOSTSTATEID$ A number that corresponds to the current state of the host: 0=UP, 1=DOWN, 2=UNREACHABLE.

Re: Wrong Host State with dummy check

Posted: Wed Sep 04, 2019 12:08 pm
by scottwilkerson
You are confusing the $HOSTSTATEID$ macro with plugin Return Code

Here is the documentation for plugin Return Code
https://assets.nagios.com/downloads/nag ... inapi.html
Return Code

Note: If the use_aggressive_host_checking option is enabled, return codes of 1 will result in a host state of DOWN or UNREACHABLE. Otherwise return codes of 1 will result in a host state of UP. The process by which Nagios Core determines whether or not a host is DOWN or UNREACHABLE is discussed here.

Re: Wrong Host State with dummy check

Posted: Thu Sep 05, 2019 2:25 am
by davide.galletti.75
Thousand Thanks !!!

that was what i was looking for!

once set use_aggressive_host_checking = 1 I'm getting may host down event.

Cheers!

Re: Wrong Host State with dummy check

Posted: Thu Sep 05, 2019 8:29 am
by scottwilkerson
davide.galletti.75 wrote:Thousand Thanks !!!

that was what i was looking for!

once set use_aggressive_host_checking = 1 I'm getting may host down event.

Cheers!
Great!

Locking