在我的 nrpe_local.cfg
添加了以下命令:
command[check_mycommand]=/usr/lib/nagios/plugins/check_command 30 35
然后重新启动 nrpe 守护进程。
当我使用
nrpe
执行此命令时我收到以下错误:NRPE: Command 'check_mycommand' not defined
我使用以下命令来执行:
/usr/lib/nagios/plugins/check_nrpe -H hostname -c check_mycommand
我无法得到任何线索。
在我的
nrpe_local.cfg
还添加了 10 个命令,它们运行正常。
最佳答案
In my nrpe_local.cfg added following command:>
command[check_mycommand]=/usr/lib/nagios/plugins/check_command 30 35
尝试 :
command[check_mycommand]=/usr/lib/nagios/plugins/check_command -w (warningTreshold) -c (criticalTreshold)
/etc/init.d/nagios-nrpe-server restart
并且确实杀死已经运行的 nrpe 的所有其他守护进程。
原因可能是它已经由不同的用户运行,这可能会导致冲突。
例如。 nagios-nrpe-server 在 root 用户和 nagios 用户下运行
还要确保将 Nagios 服务器的 IP 地址添加到/etc/nagios/nrpe.cfg 中的 allowed_hosts :
allowed_hosts=<ip address of nagios server>
否则,您将无法使用 Nagios 的 NRPE 执行外部命令。
关于Nagios NRPE : Command not defined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13795027/