0

我正在尝试像这样从我的 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文件中向上/向下更改参数参数,没有用。

4

1 回答 1

0

最后我找到了一种在从 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]' ... */
  }
}

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

于 2016-06-14T09:05:44.367 回答