本节介绍如何配置 SNMP 集成。

要配置 SNMP 集成,请执行以下操作:

  1. 编辑 /etc/snmp/snmpd.conf。将以下行添加到包含要连接到 SNMP 服务的系统源 IP 的配置中。

    以下示例将配置使用 SNMPv2c 版本通过社区字符串 vc-vcg 从 localhost 以及通过社区字符串 myentprisecommunity 从 10.0.0.0/8 对所有计数器的访问。有关更多信息,请参阅 Net-SNMP 文档。

    agentAddress udp:161
    # com2sec sec.name source community
    com2sec local localhost vc-vcg
     com2sec myenterprise 10.0.0.0/8 myentprisecommunity# group access.name sec.model sec.name 
    group rogroup v2c local
     group rogroup v2c myenterpriseview all included .1 80 
    # access access.name context sec.model sec.level match read write notif
    access rogroup "" any noauth exact all none none#sysLocation Sitting on the Dock of the Bay
    #sysContact Me <me@example.org>sysServices 72master agentx#
    # Process Monitoring
    ## At least one 'gwd' process
    proc gwd
    # At least one 'mgd' process
    proc mgd#
    # Disk Monitoring
    #
    # 100MBs required on root disk, 5% free on /var, 10% free on all other disks
    disk / 100000
    disk /var 5%
    includeAllDisks 10%#
    # System Load
    #
    # Unacceptable 1-, 5-, and 15-minute load averages
    load 12 10 5
  2. 编辑 /etc/snmp/snmpd.conf。将以下行添加到包含要连接到 SNMP 服务的系统源 IP 的配置中。
    # WARNING: only add targeted rules for addresses and ports
    # do not add blanket drop or accept rules since Gateway will append its own rules
    # and that may prevent it from functioning properly
    *filter
    :INPUT ACCEPT [0:0]
    -A INPUT -p udp -m udp --source 127.0.0.1 --dport 161 -m comment --comment "allow SNMP port" -j ACCEPT
    -A INPUT -p udp -m udp --source 10.0.0.0/8 --dport 161 -m comment --comment "allow SNMP port" -j ACCEPT
    :FORWARD ACCEPT [0:0]
    :OUTPUT ACCEPT [0:0]
    COMMIT
  3. 重新启动 snmp 和 iptables 服务:
    service snmpd restart
    service iptables-persistent restart
    service vc_process_monitor restart