negate command

Olivier F. Beauchemin (Budget-Tech IT Consulting) ofb at budget-tech.com
Sat Jan 11 01:46:02 CET 2003


Thanks for the direction. I had a bad copy of negate, so that was my first
problem. Now that that's fixed...

NOTE:
-----
I want to keep track of my non-allocated IP space. In this case it's good to
have an IP not respond, so I want to reverse the output of ping. Also, I
needed to use a bogus hostname so I could nest all the unused IPs beneath
the one host. It also makes hostgroups.cfg much more manageable. This means
I don't use $HOSTNAME$, I need to use check_pings -H argument and call it
$ARG1$. Below is the pertinent config.

Snippet from checkcommands.cfg
------------------------------
# 'check_if_unused' command definition
define command{
        command_name    check_if_unused
        command_line    $USER1$/negate
"/usr/local/nagios/libexec/check_ping -H $ARG1$ -w $ARG2$ -c $ARG3$ -p 1"
        }

Snippet from services.cfg
-------------------------
# 'check another unused ip' command definition
define service{
        use                             generic-service                ;
Name of service template to use
        host_name                       UNUSED_IP
        service_description             x.x.x.x
        contact_groups                  olivier
        is_volatile                     0
        check_period                    24x7
        max_check_attempts              3
        normal_check_interval           1
        retry_check_interval            1
        contact_groups                  madriveraccess
        notification_interval           240
        notification_period             24x7
        notification_options            c,r
        check_command
check_if_unused!x.x.x.x!100.0,20%!500.0,60%
        }

This works on the command line, which looks like this:
------------------------------------------------------
[obeauche at mrtg etc]# /usr/local/nagios/libexec/negate
"/usr/local/nagios/libexec/check_ping -H x.x.x.x -w 100.0,20% -c
500.0,60% -p 1"
PING OK - Packet loss = 0%, RTA = 0.58 ms

As I understand it, negate should then swap this OK, and return a CRITICAL,
correct?

Instead, it's passing the following:
------------------------------------
[1042244095]
SERVICE;UNUSED_IP;x.x.x.x;UNKNOWN;3/3;HARD;1042241954;1042244572;ACTIVE;1;1;
1;1042241955;0;UNKNOWN;0;40224;0;7964;0;0;1;0;0;1;0;0.00;0;1;1;1;negate:
Unknown argument - H


So, I stuffed the -H into $ARG1$ too, and now, I'm not getting the "Unknown
argument' error. However, I was expecting (and please pardon the cliche),
things to go from Red to Green. That didn't happen... they did go from
Yellow to Red, and I now get "CRITICAL - Plugin timed out after 10 seconds".

I think it's working, but not really as I expected.  Thoughts?


Olivier


----- Original Message -----
From: "Subhendu Ghosh" <sghosh at sghosh.org>


> $USER1$/negate "/path/to/check_ping -H $HOSTADDRESS -w xx -c yy"
>
> Note - the output string on the command is going to be exactly the same as
> the output string of the actual plugin.  Negate will only change the
> return code of the plugin to trigger tha approriate warning.
>
> Negate will swap CRITICAL and OK, and pass WARNING and UNKNOWN.
>
> Negate will also return a WARNING is there was any output on the plugin's
> stderr (there should be none)



-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com




More information about the Users mailing list