MRTG 两个功能:资源监控,和流量监控。
MRTG是通过snmp协议从设备得到流量信息,然后以png格式图形在html中显示。其实就是个老板麽。
=========================================
所需组建
安装支持snmp。
# rpm -ivh net-snmp-libs-5.1.2-i386.rpm
# rpm -ivh net-snmp-utils-5.1.2-i386.rpm
# rpm -ivh net-snmp-5.1.2-i386.rpm
# rpm -ivh net-snmp-devel-5.1.2-i386.rpm
配置snmp
# vi /etc/snmp/snmpd.conf
55 view systemview included .1.3.6.1.2.1.2
62 access notConfigGroup "" any noauth exact systemview none none
64 access notConfigGroup "" any noauth exact mib2 none none
89 view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc
# /etc/init.d/snmpd start
# netstat -nlupt
搭建一个支持 gd 库的 apache 服务。
# cd zlib-1.2.3/
# ./configure --prefix=/usr/local/zlib
# cd libpng-1.2.18/
# ./configure --prefix=/usr/local/libpng
# cd freetype-2.1.10/
# ./configure --prefix=/usr/local/freetype
# cd cd jpegsrc.v6/
# mkdir -pv /usr/local/jpegv6{,bin,lib,include,man/{,man1},man1}
# ./configure --prefix=/usr/local/jpegv6 --enable-shared --enable-static
# cd libxml2-2.6.19/
# ./configure --prefix=/usr/local/libxml
# cd gd-2.0.35/
# ./configure --prefix=/usr/local/gd --with-jpeg=/usr/local/jpegv6 --with-png=/usr/lcoal/libpng --with-zlib=/usr/local/zlib --with-freetype=/usr/local/freetype
# cd httpd-2.0.65/
# ./configure --prefix=/usr/local/httpd --sysconfdir=/etc/httpd2 --htmldir=/web --with-z=/usr/local/zlib --enable-rewrite --enabls-so
# cd php-5.3.3/
# ./configure --prefix=/usr/local/httpd --with-apxs2=/usr/local/httpd/bin/apxs --sysconfdir=/usr/local/httpd/etc --with-libxml-dir=/usr/local/libxml --with-zlib-dir=/usr/local/zlib --with-gd=/usr/local/gd --with-jpeg-dir=/usr/local/jpegv6 --with-png-dir=/usr/local/libpng --with-snmp --enable-zip --with-bz2
# vi /usr/local/httpd/conf/httpd.conf
LoadModule php5_module modules/libphp5.so User apache |
# /etc/init.d/snmp start
# /usr/local/httpd/bin/apachectl -k start
=========================================
MRTG安装配置启动
下载MRTG http://oss.oetiker.ch/mrtg/download.en.html
# unzip mrtg-2.15.2.zip && cd mrtg-2.15.2/
# nroff -man doc/mrtg-unix-guide.1 | more
# ./configure --sysconfdir=/etc/mrtg/mrtg.cfg && make && make install
# cd /usr/local/mrtg-2/
# bin/cfgmaker [email protected] > /etc/mrtg/mrtg.cfg
# vi /etc/mrtg/mrtg.cfg
WorkDir: /var/www/html/test Options[_]: growright, bits Language:GB2312 |
# mkdir /usr/local/httpd/htdocs/mrtg
# bin/indexmaker /etc/mrtg/mrtg.cfg --output=/usr/local/httpd/htdocs/mrtg/index.html --title="mrtg web show"
# env LANG=C bin/mrtg /etc/mrtg/mrtg.cfg
# env LANG=C bin/mrtg /etc/mrtg/mrtg.cfg --logging /var/log/mrtg.log
本文出自 “小崔的实验笔记” 博客,谢绝转载!