monitoringnagiosnrpeicinga

executing check_nrpe from iCinga2


I am trying to execute nrpe plugin from my iCinga server like this

/usr/local/nagios/libexec/check_nrpe -H <host> -c \
'nrpe_check_traffic_status' -a '2' '3'  -p <port>

I have made some print in plugin this is the result

>>opt>> -w  >> arg 2
>>opt>> -c  >> arg -p                   ### THIS LINE IS ERROR ###
Threshold values should be numerical

It is not executed properly, It sends -p as second argument instead of 3 to remote nrpe

But same working when I give like this

/usr/local/nagios/libexec/check_nrpe -H <host> -c \
'nrpe_check_traffic_status' -p <port>-a '2' '3'

Result

>>opt>> -w  >> arg 2
>>opt>> -c  >> arg 3
TRAFFIC STATUS OK; 

Did anyone faced this issue? Is there any solution for this? Or is there any way to change this argument position in iCinga2 configuration?

Note: I have tried changing argument parameter up/down in commands.conf file, no use.


Solution

  • Finally I found a way to configure arguments position while executing from icinga,

    Here is more info: iCinga_Doc

    arguments = {
      "-X" = {
        value = "$x_val$"
        key = "-Xnew"       /* optional, set a new key identifier */
        description = "My plugin requires this argument for doing X."
        required = false    /* optional, no error if not set */
        skip_key = false    /* always use "-X <value>" */
        set_if = "$have_x$" /* only set if variable defined and resolves to a numeric value. String values are not supported */
        order = -1          /* first position */
        repeat_key = true   /* if `value` is an array, repeat the key as parameter: ... 'key' 'value[0]' 'key' 'value[1]' 'key' 'value[2]' ... */
      }
      "-Y" = {
        value = "$y_val$"
        description = "My plugin requires this argument for doing Y."
        required = false    /* optional, no error if not set */
        skip_key = true     /* don't prefix "-Y" only use "<value>" */
        set_if = "$have_y$" /* only set if variable defined and resolves to a numeric value. String values are not supported */
        order = 0           /* second position */
        repeat_key = false  /* if `value` is an array, do not repeat the key as parameter: ... 'key' 'value[0]' 'value[1]' 'value[2]' ... */
      }
    }
    

    Added order and repeat_key=false to my command.conf file. This solve my problem!!