0

我正在使用 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 是返回那个错误的那个。我可以从 nrpe 客户端运行命令而没有任何问题。

我的服务和命令定义正确。

我错过了什么?

4

1 回答 1

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

您必须在中定义 check_nrpe/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
}
于 2014-08-14T09:46:48.830 回答