我正在使用nagios和npre监视2个不同的postgres数据库。我在nrpe.cfg
中有一系列有效的命令,但是当我使用此特定命令时,它显示为command "check_X_COMMAND not defined"
。
我在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客户端运行命令,没有任何问题。
我的服务和命令定义正确。
我想念什么?
您应提供确切的错误代码。哪个命令未定义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
中定义check_nrpe
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
}