我正试图从我的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
文件中上/下更改参数参数,没有用。
答案 0 :(得分: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]' ... */
}
}
将order
和repeat_key=false
添加到我的command.conf
文件中。这解决了我的问题!!