1、安装metg包
# yum -y install mrtg*
2、安装 snmp 包
#yum -y install net-snmp*
#vi /etc/snmp/snmpd.conf
将#view systemview included mib2 修改为 view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc
将 access notConfigGroup “” any noauth exact systemview none none 修改为 access notConfigGroup “” any noauth exact mib2 none none
3、启动snmp
#service snmpd start
#chkconfig –level 2345 snmpd on
查看端口的开启状况
netstat -tunlp |grep snmp
tcp 0 0 0.0.0.0:199 0.0.0.0:* LISTEN 4973/snmpd
udp 0 0 0.0.0.0:161 0.0.0.0:* 4973/snmpd
4、MRTG生成供浏览图像需要httpd服务的支持,同时也需要gcc,gd,libpng和zlib四个软件包的支持,而gcc,gd的正常运行也需要其它的几个软件,下面一并安装它们
#yum install –y gcc-*
#yum install –y gd-*
#yum install –y libpng-*
#yum install –y zlib-*
5、配置 apache
6、生成脚本
# /usr/bin/cfgmaker public@localhost > mrtg.cfg
# /usr/bin/indexmaker -output=/home/website/mrtg/index.html mrtg.cfg
# env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg