操作記錄

關於部落格
  • 12736

    累積人氣

  • 2

    今日人氣

    0

    訂閱人氣

MRTG流量統計

測試是否有MRTG相關套件
rpm -qa | grep httpd
rpm -qa | grep freetype
rpm -qa | grep libjpeg
rpm -qa | grep libpng
rpm -qa | grep gd
rpm -qa | grep mrtg
rpm -qa | grep net-snmp


 設定net-snmp
# vi /etc/snmp/snmpd.conf
新增修改下方資料
# Make at least  snmpwalk -v 1 localhost -c public system fast again.
#       name           incl/excl     subtree         mask(optional)
view    systemview    included   .1.3.6.1.2.1.1
view    systemview    included   .1.3.6.1.2.1.2
view    systemview    included   .1.3.6.1.2.1.25.1.1

重開
/etc/rc.d/init.d/snmpd restart

由於MRTG沒有utf-8的格式,因此apache需要修改編碼
# vi /etchttpd/conf/httpd.conf

AddDefaultCharset big5

重開
/etc/rc.d/init.d/httpd restart

安裝MRTG(yum)
1. # yum install mrtg
2.設定mrtg網頁
# vi /etc/httpd/conf.d/mrtg.conf

Alias /mrtg /var/www/mrtg (設定mrtg網頁要存放的資料夾)

<Location /mrtg>
    Order deny,allow
#    Deny from all (進行註解)
    Allow from 127.0.0.1
    Allow from ::1
    Allow from all (允許所有人都可觀看)

3.重開
/etc/rc.d/init.d/httpd restart

4.產生mrtg.cfg檔
# cfgmaker public@163.22.1.1 > /etc/mrtg/mrtg.cfg

5.修改mrtg.cfg檔
# vi /etc/mrtg/mrtg.cfg

EnableIPv6: no
WorkDir: /var/www/mrtg
Options[_]: bits,growright
Language: big5
Refresh: 300
Interval: 5


Target[203.64.254.39_2]: 2:public@203.64.254.39:
SetEnv[203.64.254.39_2]: MRTG_INT_IP="" MRTG_INT_DESCR="eth0"
MaxBytes[203.64.254.39_2]: 125000000

(以上三行勿修改)

Title[203.64.254.39_2]: Traffic Analysis for 2 -- ip039.puli254-64-203.ncnu.edu.tw
(設備的瀏覽標題列)

PageTop[203.64.254.39_2]: <h1>Traffic Analysis for 2 -- ip039.puli254-64-203.ncnu.edu.tw</h1>
(網頁的瀏覽標題列)

6.修改mrtg.cfg檔
# env LANG=C mrtg /etc/mrtg/mrtg.cfg
(執行三次,直到沒有錯誤訊息為止)

7.# cd /var/www/mrtg

8.更改舊的index.html為 index.html.old
# mv index.html index.html.old

9.由於不能更改檔名,所以使用連結方式建立index.html
# ln -s 203.64.254.39_2.html index.html



安裝MRTG(tar方式)
1. # cd /home/jiayu/mrtg
2. # wget http://oss.oetiker.ch/mrtg/download.en.html
3. # tar -zxvf mrtg-2.16.2.tar.gz
4. # cd mrtg-2.16.2
5. # ./configure
6. # make
7. # make install

8. # cd /usr/local/mrtg-2/bin
9. # ./cfgmaker --global 'WorkDir: /home/sawmill/www/mrtg' 
--global 'Options[_]: bits,growright'
--global 'Language: big5'
--output /home/sawmill/www/mrtg/mrtg.cfg
public@203.64.254.39

10. # ./mrtg /home/sawmill/www/mrtg/mrtg.cfg

11. # ./indexmaker --columns=1
--output=/home/jiayu/www/mrtg/index.html
--title='Traffic Info'
/home/jiayu/www/mrtg/mrtg.cfg

Reference:
http://forum.icst.org.tw/phpbb/viewtopic.php?t=14871
http://phorum.study-area.org/index.php?topic=21142.0
http://linux.vbird.org/linux_security/old/04mrtg.php

相簿設定
標籤設定
相簿狀態