argumentsnagiosnrpe

Nagios - how to use logical operators in args passed to NRPE server


I need to use logical operators on the passed argument to NRPE as Strings. the operator is also used by NRPE as the FIELD separator. Which is the splat or ! token.

different ways of quoting the passed arg. no affect.

Nagios Command.cfg
define command{
        command_name    check_remote_container_broker_health
        command_line    $USER1$/check_jmx4perl $ARG1$ $ARG2$ $ARG3$
        }

Nagios Remote Service
define service{
        use                             generic-service
        host_name                       alphprdfuse1i
        service_description             Container IPRCMT1 Broker Health
        check_command                   check_nrpe!check_remote_container_broker_health!-a '--user iprcmtx --password G00gl3M3 --url http://localhost:9091/jolokia --mbean org.apache.activemq:type=Broker,brokerName=amq,service=Health --attribute CurrentStatus --string --critical '!Good''
        }

NRPE server NRPE.cfg

command[check_remote_container_non_heap_used]=/usr/local/nagios/libexec/check_jmx4perl $ARG1$ $ARG2$

When NRPE evaluates the statement, it should perform as if return.string NOT EQUAL Good

but, NRPE is seeing this as a Field Delimiter

thank you


Solution

  • changing the NRPE Server command to:

    command[check_remote_container_broker_health]=/usr/local/nagios/libexec/check_jmx4perl $ARG1$ '!$ARG2$'
    

    on Nagios Server

    define service{
            use                             generic-service
            host_name                       alphprdfuse1i
            service_description             Container Delta FADEC Broker Health
            check_command                   check_nrpe!check_remote_container_broker_health!-a "--user deltafadec --password B@dM0nk3y --url http://localhost:9093/jolokia --mbean org.apache.activemq:type=Broker,brokerName=amq,service=Health --attribute CurrentStatus --string --critical" "Good"
            }
    

    so to remove the ! from the args being passed to NRPE, and let NRPE command issue the logical NOT or !