Upload
rodney-howard
View
226
Download
2
Embed Size (px)
Citation preview
Multi Router Traffic Grapher
陳伯岡
Outline
• What is MRTG• Why MRTG• How MRTG work• Start you own MRTG• Reference• Exercise & Homework
What is MRTG
• Multi Router Traffic Grapher– The MRTG is a tool to monitor the traffic load on
network links. – MRTG generates HTML pages containing PNG
images which provide a LIVE visual representation of this traffic.
Why MRTG
• Monitoring your computer
• Why not other tools?– Cacti– Nagios– Zabbix– RRDtool
How MRTG work
mrtg.cfg/usr/bin/mrtg
.png .html.log
data
Gather by yourself
SNMPSimple Network
Management Protocol
Start you own MRTG
• Installation– yum install• mrtg• net-snmp*
• Run snmpd– service snmpd start– chkconfig snmpd on– snmpwalk -v 1 -c public “your IP addr” system• Ex: snmpwalk -v 1 -c public 10.20.10.140 system
Start you own MRTG (cont.)
• change configuration: /etc/snmp/snmpd.conf– rocommunity public– syslocation "318"– syscontact [email protected]
• Restart snmpd
Start you own MRTG (cont.)
• cfgmaker --output=/var/www/mrtg/net/mrtg.cfg \[email protected]
• vi mrtg.cfg– WorkDir: /var/www/mrtg/net/– Options[local]: growright, bits– Language: BIG5– Target[local]:2:[email protected]– Title[local]:Netflow– MaxBytes[local]:12500000– PageTop[local]: <H1>Netstat Info on 10.20.10.140</H1>
• indexmaker --output=/var/www/mrtg/net/index.html \ /var/www/mrtg/net/mrtg.cfg
Start you own MRTG (cont.)
• crontab –e– */5 * * * * /usr/bin/mrtg /var/www/mrtg/net/mrtg.cfg
• Then you can check the MRTG through your httpd
Reference
• MRTG 官方網站– http://oss.oetiker.ch/mrtg/
• 鳥哥 MRTG– http://linux.vbird.org/linux_security/old/
04mrtg.php
Exercise & Homework
• Exercise1. 按照投影片的步驟,利用 SNMP 監測自己主機的網路
流量2. 利用自行抓取資料的方式,監測自己主機的 CPU 使用
率• Homework
1. 參考 http://oss.oetiker.ch/mrtg/doc/mrtg-reference.en.html 改變圖中線條的顏色
2. 發揮想像力,監測自己主機任意一項流量