ADJ網路實驗室
打印

[介紹] F7 (Fedora 7) 上安裝 MRTG 說明

F7 (Fedora 7) 上安裝 MRTG 說明

學生用伺服器建置流程(Fedora Core X 版)
http://apt.nc.hcc.edu.tw/web/student_server_FC5/appendix.html#mrtg

MRTG - Multi Router Traffic Grapher
MRTG 官方網站:http://oss.oetiker.ch/mrtg/

yum -y install net-snmp mrtg gd libpng zlib

產生設定檔:

mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.bak
vi /etc/snmp/snmpd.conf

com2sec local localhost public
com2sec mynetwork 192.168.128.0/24 public

group MyRWGroup any local
group MyROGroup any mynetwork
group MyRWGroup any otherv3user

view all included .1 80
access MyROGroup "" any noauth 0 all none none
access MyRWGroup "" any noauth 0 all all all

syslocation Fedora Core 5
syscontact sysadm <sysadm@xxx.xxx.edu.tw>

啟動 snmpd:

/etc/rc.d/init.d/snmpd start
chkconfig snmpd on

確認 snmpd 有執行

[root@localhost ~]# service snmpd restart

[root@localhost ~]# service snmpd status
snmpd (pid 3168) is running...

建立放置網頁的資料夾:

mkdir /var/www/mrtg/web

產生 mrtg.cfg:

cfgmaker --global 'WorkDir: /var/www/mrtg/web' \
--global 'Options[_]: growright' \
--output /etc/mrtg/mrtg.cfg \
public@192.168.128.0

出現下面錯誤

--base: Get Device Info on public@192.168.128.129:
SNMP Error:
no response received
SNMPv1_Session (remote host: "192.168.128.129" [192.168.128.129].161)
community: "public"
request ID: 1382243586
PDU bufsize: 8000 bytes
timeout: 2s
retries: 5
backoff: 1)
at /usr/bin/../lib/mrtg2/SNMP_util.pm line 627
SNMPWALK Problem for 1.3.6.1.2.1.1 on public@192.168.128.129::::::v4only
at /usr/bin/cfgmaker line 924
WARNING: Skipping public@192.168.128.129: as no info could be retrieved

--base: Writing /etc/mrtg/mrtg.cfg

修改 mrtg.cfg:

cp /etc/mrtg/mrtg.cfg /etc/mrtg/mrtg.cfg.bak
vi /etc/mrtg/mrtg.cfg

#在 20行 Options[_]: growright 這一行下面加上

Language:big5

註:修改此檔案的內容(假如有需要的話)

產生網頁:

env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg
env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg
env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg

#執行三次

產生索引頁:

若有多個機器要監控,可以用索引頁來放置多個機器的圖表

cd /var/www/mrtg/web
indexmaker /etc/mrtg/mrtg.cfg > index.html

設定瀏覽範圍:

cp /etc/httpd/conf.d/mrtg.conf /etc/httpd/conf.d/mrtg.conf.bak
vi /etc/httpd/conf.d/mrtg.conf

Alias /mrtg /var/www/mrtg
<Location /mrtg>
Order deny,allow
Deny from all
Allow from 127.0.0.1 修改成--> Allow from 192.168.1.0/255.255.255.0
Allow from ::1
# Allow from .example.com
</Location>

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

測試:http://IP/mrtg/web/

定時更新:more /etc/cron.d/mrtg

MRTG 官方文件:http://oss.oetiker.ch/mrtg/doc/
參考:http://forum.icst.org.tw/phpBB2/viewtopic.php?t=13689





TOP

ARTERY.cn