2012-12-16
Shau-Rong Lu
MRTG官方安裝方法
http://oss.oetiker.ch/mrtg/doc/mrtg-unix-guide.en.html
# mrtg-2.17.4.tar.gz_install.sh echo -e "\033[31;42m ********** Install mrtg-2.17.4.tar.gz on CentOS 6.3 x86 ********** \033[0m" echo -e "\033[31m 2012/12/16 ********** \033[0m" echo -e "\033[31m by Shau-Rong Lu ********** \033[0m" # Check SELinux status if [ "`grep SELINUX=disabled /etc/selinux/config`" == "" ]; then # disable SELinux now /usr/sbin/setenforce 0 # disable SELinux after every reboot # echo "/usr/sbin/setenforce 0" >> /etc/rc.local #or # disable SELinux always sed -i -e "s@SELINUX=enforcing@#SELINUX=enforcing@" /etc/selinux/config sed -i -e "s@SELINUX=permissive@#SELINUX=permissive@" /etc/selinux/config sed -i -e "/SELINUX=/aSELINUX=disabled" /etc/selinux/config fi # Kill yum on running... ProcessID="`ps aux | grep yum | awk '{print $2}' `" for i in $ProcessID do echo $i kill -9 $i done # ************************************************ yum -y install gcc perl gd libpng zlib httpd net-snmp net-snmp-utils gd-devel libpng-devel zlib-devel wget echo "view systemview included .1.3.6.1.2.1.2.2.1.10" >> /etc/snmp/snmpd.conf echo "view systemview included .1.3.6.1.2.1.2.2.1.16" >> /etc/snmp/snmpd.conf service snmpd restart cd /usr/local/src wget http://oss.oetiker.ch/mrtg/pub/mrtg-2.17.4.tar.gz tar zxvf mrtg-2.17.4.tar.gz cd mrtg-2.17.4 ./configure --prefix=/usr/local/mrtg-2 make make install mkdir /var/www/html/mrtg # 產生 /etc/mrtg.cfg /usr/local/mrtg-2/bin/cfgmaker --global 'WorkDir: /var/www/html/mrtg' --global 'Options[_]: bits,growright' --output /etc/mrtg.cfg community@localhost.localdomain echo "Target[eth0]: 2:public@127.0.0.1" >> /etc/mrtg.cfg echo "MaxBytes[eth0]: 1250000" >> /etc/mrtg.cfg echo "Title[eth0]: Traffic Analysis" >> /etc/mrtg.cfg echo "PageTop[eth0]: <H1>127.0.0.1 eth0</H1>" >> /etc/mrtg.cfg # 根據 /etc/mrtg.cfg 內容,產生基本圖片 env LANG=C /usr/local/mrtg-2/bin/mrtg /etc/mrtg.cfg env LANG=C /usr/local/mrtg-2/bin/mrtg /etc/mrtg.cfg env LANG=C /usr/local/mrtg-2/bin/mrtg /etc/mrtg.cfg # 根據 /etc/mrtg.cfg 內容,產生首頁 /usr/local/mrtg-2/bin/indexmaker /etc/mrtg.cfg > /var/www/html/mrtg/index.html # 設定排成,每5分鐘產生一次新圖片 echo "*/5 * * * * root env LANG=C /usr/local/mrtg-2/bin/mrtg /etc/mrtg.cfg --logging /var/log/mrtg.log" >> /etc/crontab 或 echo "*/5 * * * * root env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg > /dev/null 2>&1 " >> /etc/crontab # 開放其他主機瀏覽 sed -i -e "s@Deny from all@#Deny from all@" /etc/httpd/conf.d/mrtg.conf service httpd restart firefox http://localhost/mrtg & |
snmpd.conf 的 systemview 數值意義請參考
http://oss.oetiker.ch/mrtg/doc/mrtg-mibhelp.en.html
mrtg.cfg 中 public 前面的數字可用下面偵測, 一般 eth0 代號是 2
[root@localhost ~]# ip link 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000 link/ether 00:0c:29:65:0f:5f brd ff:ff:ff:ff:ff:ff 3: sit0: <NOARP> mtu 1480 qdisc noop link/sit 0.0.0.0 brd 0.0.0.0 |
PS: 開放其他機器查詢
vim /etc/httpd/conf.d/mrtg.cfg |
<Location /mrtg> Order deny,allow Deny from all Allow from 127.0.0.1 Allow from ::1 # Allow from .example.com </Location> |
<Location /mrtg> Order deny,allow Deny from all Allow from 192.168.100.100 Allow from 172.16 Allow from 192.168.128.0/255.255.255.0 Allow from 10.1.0.0/16 Allow from 127.0.0.1 Allow from ::1 # Allow from .example.com </Location> |
service httpd restart |
(完)
參考
[研究] MRTG 2.17.4 安裝(tar.gz)(CentOS 6.3 x86)
http://forum.icst.org.tw/phpbb/viewtopic.php?t=79225
[研究] MRTG 2.17.2安裝(yum)(Fedora 16 x86)
http://forum.icst.org.tw/phpbb/viewtopic.php?t=21201
[研究] MRTG 2.17.2安裝(yum)(CentOS 6.2 x86)
http://forum.icst.org.tw/phpbb/viewtopic.php?t=21196
[研究] MRTG 2.17.1 安裝(tar.gz)(CentOS 6.0 x86)
http://forum.icst.org.tw/phpbb/viewtopic.php?t=20208
[研究] MRTG 2.17.0 安裝(tar.gz)(Fedora 14 x86)
http://forum.icst.org.tw/phpbb/viewtopic.php?t=19191
[研究] MRTG 2.16.4 安裝(yum)(Fedora 14 x86)
http://forum.icst.org.tw/phpbb/viewtopic.php?t=19192
[研究] MRTG 2.16.3 安裝(tar.gz)(CentOS 5.4 x86)
http://forum.icst.org.tw/phpbb/viewtopic.php?t=17992
[研究] MRTG 2.16.2安裝(yum)(CentOS 6.0 x86)
http://forum.icst.org.tw/phpbb/viewtopic.php?t=20207
[研究] MRTG 2.16.2 安裝(yum)(CentOS 6.3 x86)
http://forum.icst.org.tw/phpbb/viewtopic.php?t=79309
[研究] MRTG 2.14.5 安裝(yum)(CentOS 5.4 x86)
http://forum.icst.org.tw/phpbb/viewtopic.php?t=17991
[研究] MRTG 快速安裝程式精簡版(Fedora 8 )
http://forum.icst.org.tw/phpbb/viewtopic.php?t=14872
[研究] MRTG 快速安裝程式 (CentOS 5.1)
http://forum.icst.org.tw/phpbb/viewtopic.php?t=14871
[研究] MRTG 安裝(yum)(Fedora 7)
http://forum.icst.org.tw/phpbb/viewtopic.php?t=13689
[研究] MRTG 安裝(Fedora Core 4)
http://forum.icst.org.tw/phpbb/viewtopic.php?t=7014
[研究] MRTG 安裝 (Fedora Core 3)
http://forum.icst.org.tw/phpbb/viewtopic.php?t=8168
沒有留言:
張貼留言