There is a device in my network that should usually not be reachable, unless for updates and maintenance.
Is there a way to configure icinga in such a way that it sets the host state to critical when it is reachable?
2 Likes
Thank you. I wanted to make sure that there is no direct way to do this in icinga itself or with a community plugin.
Hello Ricochet,
I know your post is quite old, but maybe other people are searching for a ‘built-in’ solution. You can use the negate
monitoring plugin for this case.
Excerpt from the help text:
icinga# /usr/lib/nagios/plugins/negate --help
negate v2.3.5 (monitoring-plugins 2.3.5)
Copyright (c) 2002-2008 Monitoring Plugins Development Team
<devel@monitoring-plugins.org>
Negates the status of a plugin (returns OK for CRITICAL and vice-versa).
Additional switches can be used to control which state becomes what.
Usage:
negate [-t timeout] [-Towcu STATE] [-s] <definition of wrapped plugin>
Sample usage (-s
switch substitutes the output):
icinga# /usr/lib/nagios/plugins/check_ping 127.0.0.1 -c 200,15% -w 100,5% ; echo $?
PING OK - Packet loss = 0%, RTA = 0.04 ms|rta=0.044000ms;100.000000;200.000000;0.000000 pl=0%;5;15;0;
0
icinga# /usr/lib/nagios/plugins/negate /usr/lib/nagios/plugins/check_ping 127.0.0.1 -c 200,15% -w 100,5% ; echo $?
PING OK - Packet loss = 0%, RTA = 0.03 ms|rta=0.033000ms;100.000000;200.000000;0.000000 pl=0%;5;15;0;
2
icinga# /usr/lib/nagios/plugins/negate -s /usr/lib/nagios/plugins/check_ping 127.0.0.1 -c 200,15% -w 100,5% ; echo $?
PING CRITICAL - Packet loss = 0%, RTA = 0.04 ms|rta=0.038000ms;100.000000;200.000000;0.000000 pl=0%;5;15;0;
2
Regards,
Bernd
2 Likes