【作業メモ】Catalyst2960GのトラフィックをMRTGで監視する

mrtg.jpg
【目的】
スイッチングハブ(Cisco Catalyst2960G)のトラフィックを監視する。
【作業時間】
・30分
【使うもの】
・CentOS 7.2(webサーバ, snmpサーバ)
・Catalyst 2960G (WS-C2960G-24TC-L)
【前提条件】
・サーバIPアドレス(192.168.0.201)、Catalyst 2960管理IPアドレス(192.168.0.254)
・Webサービス(apache)は稼働している
・index.htmlは/var/www/html/mrtg配下に置く
【スイッチ設定】
hostname(config)# snmp-server community Serverworld RO
hostname(config)# exit
hostname# copy running-config startup-config
【サーバ設定】
# mkdir /var/www/html/mrtg
# yum install net-snmp net-snmp-utils mrtg
# cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.ORG
# vim /etc/snmp/snmpd.conf
# diff /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.ORG

41c41
< #com2sec notConfigUser default public --- > com2sec notConfigUser default public
74,75c74,75
< com2sec local localhost Serverworld < com2sec mynetwork 192.168.0.0/24 Serverworld --- > #com2sec local localhost COMMUNITY
> #com2sec mynetwork NETWORK/24 COMMUNITY
78,79c78,79
< group MyRWGroup v2c local < group MyROGroup v2c mynetwork --- > #group MyRWGroup any local
> #group MyROGroup any mynetwork
85c85
< view all included .1 80 --- > #view all included .1 80
93,94c93,94
< access MyROGroup "" v2c noauth exact all none none < access MyRWGroup "" v2c noauth exact all all all --- > #access MyROGroup “” any noauth 0 all none none
> #access MyRWGroup “” any noauth 0 all all all

# systemctl start snmpd
# systemctl enable snmpd
# snmpwalk -v2c -c Serverworld localhost system
# cfgmaker –output=/etc/mrtg/mrtg.cfg Serverworld@192.168.0.254
# vim /etc/mrtg/mrtg.cfg

WorkDir: /var/www/html/mrtg

Options[_]: growright, bits

Title[192.168.0.254_1]: Vlan1
PageTop[192.168.0.254_1]:

Vlan1


以下同様にI/Fの名前を変える

# env LANG=C mrtg /etc/mrtg/mrtg.cfg
# env LANG=C mrtg /etc/mrtg/mrtg.cfg
# env LANG=C mrtg /etc/mrtg/mrtg.cfg
# indexmaker –columns=2 /etc/mrtg/mrtg.cfg > /var/www/html/mrtg/index.html
ブラウザよりhttp://192.168.0.201/mrtg/にアクセスし動作を確認
# vim /etc/cron.d/mrtg

*/5 * * * * root LANG=C LC_ALL=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg –lock-file /var/lock/mrtg_l –confcache-file /var/lib/mrtg/mrtg.ok

【参考】
http://www.infraexpert.com/study/snmp3.htm
http://www.itbook.info/study/p45.html
http://changineer.info/server/monitoring/monitoring_mrtg.html

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です