本節說明如何設定 SNMP 整合。
若要設定 SNMP 整合:
- 編輯 /etc/snmp/snmpd.conf。將下列幾行新增至組態,並指定將連線至 SNMP 服務的系統來源 IP。
下列範例將設定使用 SNMPv2c 版本以透過 localhost (透過社群字串 vc-vcg) 和 10.0.0.0/8 (透過社群字串
myentprisecommunity) 存取所有計數器。如需詳細資訊,請參閱 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
- 編輯 /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
- 重新啟動 snmp 和 iptables 服務:
service snmpd restart service iptables-persistent restart service vc_process_monitor restart