nagios nrpe 传参数

【基本介绍】
nrpe客户端编写的脚本需要从nagios服务器端传递参数过来,这样就提高脚本的维护性。

【方法】
nrpe客户端
使用变量$ARG1$ ...
command[check_xxx]=/usr/local/nagios/libexec/check_xxx $ARG1$ $ARG2$


command[check_xxx]=/usr/local/nagios/libexec/check_xxx -w $ARG1$ -c $ARG2$


nagios服务端
check_command                   check_nrpe! -p 5666  -c check_xxx -a  arg1 arg2



如果变量中有参数(-d ,-w)类似的option参数,我们把他当做一个参数来使用
nrpe客户端
使用变量$ARG1$到$ARG4$来代表"-w 20% -w 10%"
command[check_xxx]=/usr/local/nagios/libexec/check_xxx $ARG1$ $ARG2$ $ARG3$ $ARG4$


nagios服务端
check_command                   check_nrpe! -p 5666  -c check_xxx -a  "-d arg2 -w arg4"


如果ARG1 ARG3是option的话,
客户端
command[check_xxx]=/usr/local/nagios/libexec/check_xxx -w $ARG1$ -c $ARG2$


服务端
check_command                   check_nrpe! -p 5666  -c check_xxx -a  arg1 arg2

你可能感兴趣的:(linux,command,arguments,nagios,nrpe)