从 iCinga2 执行 check_nrpe

executing check_nrpe from iCinga2

我正在尝试像这样从我的 iCinga 服务器执行 nrpe 插件

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

我在插件里做了一些打印,这是结果

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

它没有正确执行,它将 -p 作为第二个参数而不是 3 发送到远程 nrpe

但是当我这样给予时同样有效

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

结果

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

有人遇到过这个问题吗?有什么解决办法吗? 或者有什么方法可以改变 iCinga2 配置中的这个参数位置?

注意:我曾尝试更改 commands.conf 文件中的参数参数 up/down,但没有用。

最后我找到了一种在从 icinga 执行时配置参数位置的方法,

这里有更多信息: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]' ... */
  }
}

在我的 command.conf 文件中添加了 orderrepeat_key=false。这解决了我的问题!!