如何向Nagios Core 4.X添加插件

时间:2014-07-26 10:33:31

标签: unix nagios

我想问一下,如何在nagios核心4.X中添加插件(如下)

http://exchange.nagios.org/directory/Plugins/Network-Protocols/ICMP/chech_hping/details

我总是遇到错误:

Error: Service check command 'check_hping' specified in service 'HPING3' for host 'cam_chodba' not defined anywhere

我在/usr/local/nagios/etc/objects/commands.cfg中定义了命令:

define command{
    command_name    check-ping-on-port
    command_line    /usr/local/nagios/libexec/check_hping $HOSTADDRESS$ 100 500 $ARG1$
    }

以及/usr/local/nagios/etc/objects/switch.cfg中的主机和服务:

define host{
    use             generic-switch
    host_name       cam_chodba
    alias           cam_chodba
    address         1.2.3.4
    check_command   check-ping-on-port
    hostgroups      switches
    }

define service{
        use                     generic-service
        host_name               cam_chodba
        service_description     HPING3
        check_command           check_hping
        }

当我尝试运行一个命令时,它正在运行 - >

root@onedata-desktop:~# /home/onedata/Downloads/check_hping 188.123.99.171 200 500 10201
OK: Average response time 10 ms; packet loss 0%

感谢您的帮助!

1 个答案:

答案 0 :(得分:1)

您将命令定义为command_name check-ping-on-port,但是通过服务check_command check_hping中的exe名称调用它。将第一个更改为check_command check-ping-on-port,您应该很好。

define service{
    use                     generic-service
    host_name               cam_chodba
    service_description     HPING3
    check_command           check-ping-on-port
    }