查看完整版本: F7 (Fedora 7) 上安裝 MRTG 說明


adj 2007-11-30 20:41

F7 (Fedora 7) 上安裝 MRTG 說明

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

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

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 <[email]sysadm@xxx.xxx.edu.tw[/email]>

啟動 snmpd:

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

[color=blue]確認 snmpd 有執行

[root@localhost ~]# service snmpd restart

[root@localhost ~]# service snmpd status
snmpd (pid 3168) is running...[/color]
建立放置網頁的資料夾:

mkdir /var/www/mrtg/web

產生 mrtg.cfg:

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

[color=red]出現下面錯誤

--base: Get Device Info on [email=public@192.168.128.129][color=#006699]public@192.168.128.129[/color][/email]:
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 [email=public@192.168.128.129][color=#006699]public@192.168.128.129[/color][/email]::::::v4only
at /usr/bin/cfgmaker line 924
WARNING: Skipping [email=public@192.168.128.129][color=#006699]public@192.168.128.129[/color][/email]: as no info could be retrieved

--base: Writing /etc/mrtg/mrtg.cfg[/color]
修改 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 官方文件:[url=http://oss.oetiker.ch/mrtg/doc/]http://oss.oetiker.ch/mrtg/doc/[/url]
參考:[url=http://forum.icst.org.tw/phpBB2/viewtopic.php?t=13689]http://forum.icst.org.tw/phpBB2/viewtopic.php?t=13689[/url]
頁: [1]
查看完整版本: F7 (Fedora 7) 上安裝 MRTG 說明