debian – Nagios命令不传输所有参数

我正在使用以下服务来监控来自nagios的postgres数据库
define service{
       use                             test-service         ; Name of servi$
       host_name                       DEMocgN002
       service_description             Postgres State
       check_command                   check_nrpe!check_pgsql!192.168.1.135!test!test!test
       notifications_enabled           1
       }

在远程计算机上我配置了命令:

command[check_pgsql]=/usr/lib/nagios/plugins/check_pgsql -H $ARG1$-d $ARG2$-l $ARG3$-p $ARG4$

在syslog中,我可以看到该命令已执行,但只传输了一个参数:

Oct 20 13:18:43 DEMOSRV01 nrpe[1033]: Running command: /usr/lib/nagios/plugins/check_pgsql -H 192.168.1.134 -d  -l  -p 
Oct 20 13:18:43 DEMOSRV01 nrpe[1033]: Command completed with return code 3 and output: check_pgsql: Database name is not valid - -l#012Usage:#012check_pgsql [-H <host>] [-P <port>] [-c <critical time>] [-w <warning time>]#012 [-t <timeout>] [-d <database>] [-l <logname>] [-p <password>]
Oct 20 13:18:43 DEMOSRV01 nrpe[1033]: Return Code: 3,Output: check_pgsql: Database name is not valid - -l#012Usage:#012check_pgsql [-H <host>] [-P <port>] [-c <critical time>] [-w <warning time>]#012 [-t <timeout>] [-d <database>] [-l <logname>] [-p <password>]

为什么参数2,3和4缺失?

您将监视主机上定义的参数与远程主机上的参数混合在一起. $ARGx $宏不能在NRPE主机上使用.

认情况下,check_nrpe命令定义如下:

define command{
    command_name    check_nrpe
    command_line    $USER1$/check_nrpe -H $HOSTADDRESS$-c $ARG1$-t 120
}

在远程主机上,您必须使用“真实”值,如下所示:

command[check_pgsql]=/usr/lib/nagios/plugins/check_pgsql -d test -l test -p test

并且可以从Nagios主机调用此命令:

define service{
    use                     test-service         
    host_name               DEMocgN002
    service_description     Postgres State
    check_command           check_nrpe!check_pgsql
    notifications_enabled   1
    }

无需传递IP地址,因为它获取host_name的值.

相关文章

项目需要,有个数据需要导入,拿到手一开始以为是mysql,结果...
本文小编为大家详细介绍“怎么查看PostgreSQL数据库中所有表...
错误现象问题原因这是在远程连接时pg_hba.conf文件没有配置正...
因本地资源有限,在公共测试环境搭建了PGsql环境,从数据库本...
wamp 环境 这个提示就是说你的版本低于10了。 先打印ph...
psycopg2.OperationalError: SSL SYSCALL error: EOF detect...