我在 nagios 中有两个 NRPE 检查失败,因为在 nagios Web 界面中未定义。
这很奇怪,因为:
1) 我在 nagios 服务器上的该主机的配置文件中定义了检查。在 /usr/local/nagios/etc/objects/web2.cfg 我有这两个定义。
# Define a service to check Cassandra reads on the web2 machine.
define service{
use generic-service
host_name web2
service_description Check NRPE Cassandra JMX
contact_groups linux-admins
check_command check_nrpe!check_cassandra_jmx
notifications_enabled 1
}
# Define a service to check Cassandra reads on the web2 machine.
define service{
use generic-service
host_name web2
service_description Check NRPE Cassandra Heap
contact_groups linux-admins
check_command check_nrpe!check_cassandra_heap
notifications_enabled 1
}
2)我在我正在检查的主机上的 nrpe.cfg 中定义了检查:
[root@web2:~] #egrep "heap|jmx" /usr/local/nagios/etc/nrpe.cfg
command[check_cassandra_jmx]=/usr/local/nagios/libexec/check_jmx -U service:jmx:rmi:///jndi/rmi://beta.jokefire.com:7199/jmxrmi -O java.lang:type=Memory -A HeapMemoryUsage -K used -I HeapMemoryUsage -J used -vvvv -w 10737418240 -c 20401094656
command[check_cassandra_heap]=/usr/local/nagios/libexec/cassandra.pl
3)如果我回到nagios主机并在命令行上通过check_nrpe运行命令,它会成功:
[root@monitor1:~] #/usr/local/nagios/libexec/check_nrpe -H web2.mydomain.com -c check_cassandra_jmx
JMX OK HeapMemoryUsage.used=142913536{committed=526385152;init=536870912;max=526385152;u sed=142913536}
[root@monitor1:~] #/usr/local/nagios/libexec/check_nrpe -H web2.mydomain.com -c check_cassandra_heap
CASSANDRA OK - | heap_mem=27.46
此主机的其他检查在 Web 界面中运行良好。有没有人对这种情况下出了什么问题有一些想法?
谢谢!