Good morning / afternoon!

I have one http check that I am trying to convert from Nagios over to Icinga2 
but its kicking my butt. In a nutshell, the way this check works is the icinga 
host uses nrpe to run a command on the destination host which, in turn, tries 
to verify that that host can reach an outside host (ie icinga —> SERVERNAME —> 
amazonaws.com).

The problem that I am coming across is that this check only runs when the nrpe 
arguments are encapsulated within quotes, something Icinga can’t process. If I 
escape the quotes in the check, the remote host doesn’t like it and returns the 
following error:

Client request was invalid, bailing out...
Error: Request contained illegal metachars!

Here is how I have it currently configured...

object CheckCommand "check_http_remote" {
        import "nrpe-common"
        command = [ PluginDir + "/check_nrpe","-H", "$host.address$", "-t", 
"30", "-c", "check_http_remote", "-a", "$ARG1$”]


apply Service "pingS3" {
        import "generic-service"
        display_name = "pingS3"
        check_command = "check_http_remote"

        vars += {
                "ARG1" = "-H s3.amazonaws.com -u 
https://s3.amazonaws.com/blahblahblah.txt";
                }

        assign where host.vars.servertype in [“remote_server"]
}

...and this is how it is configured in nagios

define command{
        command_name    check_http_remote
        command_line    $USER1$/check_nrpe -H $HOSTADDRESS$ -c 
check_http_remote -a "$ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$ $ARG7$ $ARG8$ 
$ARG9$ $ARG10$ $ARG11$ $ARG12$ $ARG13$ $ARG14$ $ARG15$ $ARG16$ $ARG17$ $ARG18$ 
$ARG19$ $ARG20$"


define service {
        use                             generic
        service_description             pingS3
        check_command                   
check_http_remote!-H!s3.amazonaws.com!-u!https://s3.amazonaws.com/blahblahblah.txt!-t!30

Lastly, here are the results of a manual run from the icinga server, the first 
without quotes and the second with.

/usr/lib64/nagios/plugins/check_nrpe -H SERVERNAME -c check_http_remote -t 30 
-a -H s3.amazonaws.com -u https://s3.amazonaws.com/blahblahblah.txt
Name or service not known
HTTP CRITICAL - Unable to open TCP socket

/usr/lib64/nagios/plugins/check_nrpe -H SERVERNAME -c check_http_remote -t 30 
-a "-H s3.amazonaws.com -u https://s3.amazonaws.com/blahblahblah.txt";
HTTP OK: HTTP/1.1 200 OK - 496 bytes in 0.050 second response time 
|time=0.049625s;;;0.000000 size=496B;;;0

Any thoughts on how I can overcome this and still use the same check? I can 
code my way out of this by running individual scripts on each server and 
calling them from Icinga but that doesn’t seem like the right way of doing it.
_______________________________________________
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to