我使用nagios和npre来监控2个不同的postgres数据库。 我在nrpe.cfg中有一系列命令可以工作,但是当我使用这个特殊的命令时,它会说"命令" check_X_COMMAND未定义"。
我在nrpe中使用了两次命令,对于我要检查的每个数据库都使用一次: command [check_postgres_check_lock_db1] = / etc / nagios / check_postgres_locks --dbname = DB1 command [check_postgres_check_lock_db2] = / etc / nagios / check_postgres_locks --dbname = DB2
DB1是返回该错误的on。 我可以毫无问题地从nrpe客户端运行命令。
我的服务和命令已正确定义。
我错过了什么?
答案 0 :(得分:0)
您应该提供确切的错误代码。哪个命令是未定义的check_nrpe或check_postgres_check_lock_db1?我猜第一个。
如果命令真正适用于nrpe客户端(所以nagios服务器)
/path_to_nagios/libexec/check_nrpe -H server -t 30 -c check_postgres_check_lock_db1
您必须在/path_to_nagios/etc/objects/commands.cfg
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$
}
然后你可以在server.cfg
中使用它define service {
use generic-service
host_name server
service_description db
check_command check_nrpe!check_postgres_check_lock_db1
}