在 Nagios 中无法获得服务监控 SNMP 的正确语法

问题描述

我无法让它工作,我很好奇......我做错了什么......:)

我是一台装有 Nagios Core 4.4 的 debian 服务器,我想添加自定义命令以拥有更好的监控系统并监控更多服务。

我已将 nutanix HCI 的 MIB 文件导入并复制到 nagios 服务器 (/usr/share/snmp/mibs/NUTANIX.MIB.txt)

当我在 nagios 服务器上运行它时,我得到了正确的输出

./check_snmp -P 3 -U nagios -L authPriv -a SHA [key] -x AES -X [key] IP -o 1.3.6.1.4.1.41263.508.0

当我把它放在我的 commands.cfg 中时

define command{
          command_name check_snmp_clusterstatus
          command_line /usr/local/nagios/libexec/./check_snmp -P 3 -U nagios -L authPriv -a SHA -A [key] -x AES -X [key] IP -o 1.3.6.1.4.1.41263.508.0
          }

这在我的主机文件


define host{
        use             generic-server
        host_name       hostname
        alias           hostname
        address         IP
    hostgroups  test-hosts
        }


define service{
        use                     CHECK_SNMP_V3
        host_name               Cluster
        service_description     ClusterIops
        flap_detection_enabled  1
        check_command           check_snmp!--protocol=3 -U nagios -L authPriv -a SHA -A [key] -x AES -X [key] -o 1.3.6.1.4.1.41263.508.0
        }

它不起作用,我无法让它工作。有人知道正确的语法还是我在这里做错了什么...

我已经尝试过本指南,但对我来说它不起作用。

由于服务配置不正确而不断出现错误

https://next.nutanix.com/how-it-works-22/monitoring-nutanix-with-nagios-4500

提前致谢:)

解决方法

您没有调用根据“服务”定义创建的命令。它应该是这样的:

define service{
    use                     CHECK_SNMP_V3
    host_name               Cluster
    service_description     ClusterIops
    flap_detection_enabled  1
    check_command           check_snmp_clusterstatus!--protocol=3 -U nagios -L authPriv -a SHA -A [key] -x AES -X [key] -o 1.3.6.1.4.1.41263.508.0
    }