- 论坛徽章:
- 0
|
linux下需要的软件:\r\ngd-1.8.4-11、gd-devel-1.8.4-11、libpng-1.2.2-16、libpng-devel-1.2.2-16、libpng10-1.0.13-8、libpng10-devel-1.0.13-8、perl-5.8.0-88、zlib-1.1.4-8、zlib-devel-1.1.4-8、httpd-2.0.40-21、gcc-3.2.2-5、net-snmp-5.06-17、mrtg-2.14.5.tar.gz 需下载\r\nftp://ftp.idilis.ro/mirrors/mrtg/mrtg-2.16.2.tar.gz(最新)\r\n\r\n查看软件包是否已经安装,如:#rpm -qa | grep gd\r\n没有安装有直接从光盘安装\r\n#Cd /mnt\r\n#Mount cdrom\r\n#Cd cdrom/RedHat/RPMS\r\n# rpm -ivh gd-devel-1.8.4-11.i386.rpm\r\nwarning: gd-devel-1.8.4-11.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e\r\nPreparing... ########################################### [100%]\r\n 1:gd-devel ########################################### [100%]\r\n……\r\n……\r\n确定需要的软件都安装好后,现在继续MRTG的安装。管理站地址为192.168.1.30,被管理站地址为:172.16.30.3\r\n(1)首先,修改snmp的配置文件:\r\n#vi /etc/snmp/snmpd.conf\r\n把第89行前面的注释符号#去掉,变成 \r\nview mib2 included .iso.org.dod.internet.mgmt.mib-2 fc\r\n在62行进行修改:将\r\naccess notConfigGroup \"\" any noauth exact systemview none none\r\n改为\r\naccess notConfigGroup \"\" any noauth exact mib2 none none\r\n\r\n(2)启动http服务和snmp服务:\r\n首先查看两个服务在系统启动时是否已经开启\r\n#chkconfig --list | grep httpd\r\n没有启动的话需要修改下在什么启动模式下要自己启动:\r\n# chkconfig --level 35 httpd on\r\n如下说明已经成功:\r\nhttpd 0 ff 1 : off 2 : off 3 : on 4 : off 5 : on 6 : off\r\n(原文粘出来后被坛子的笑脸占用了! )\r\n对snmpd 服务采用同样的设置。\r\n现在手动启动下\r\n# service httpd start\r\n#service snmpd start\r\n4.查看端口的开启状况 \r\n# netstat -tunlp |grep snmp \r\ntcp 0 0 0.0.0.0:199 0.0.0.0:* LISTEN 1129/snmpd \r\nudp 0 0 0.0.0.0:161 0.0.0.0:* 1129/snmpd \r\n(3)开始安装mrtg\r\n#tar zvxf mrtg-2.16.2.tar.gz\r\n#mkdir /usr/local/mrtg\r\n#cd mrtg-2.16.2#./configure --prefix=/usr/local/mrtg \r\n(很有意思的是在执行完提示成功的时候,会有这么一句^_^:\r\nordering CD from http://tobi.oetiker.ch/wish .... just kidding ; -) \r\n很搞吧!!!)\r\n\r\n#make && make install\r\n“--prefix=/usr/local/mrtg”是指定的安装路径。OK,安装完毕下面配置mrtg\r\n(4)配置MRTG\r\n首先为mrtg的主页建立一个目录,\r\n使用RPM包安装的Apache默认路径是/var/www/html/\r\n在此目录下新建目录mrtg:\r\n#md /var/www/html/mrtg \r\n如果路径嫌长感到不方便的话可以使用符号链接,\r\n我在root目录下 ln –s /var/www/html/mrtg mrtg 建了个符号链接。\r\n在上面新建的目录下再建一个images目录\r\n#md / mrtg/images\r\n进入mrtg的安装目录后\r\n#cd mrtg-2.16.2\r\n#cp ./images/* /mrtg/images/\r\n然后需要创建一个配置文件:\r\n我在root目录下也为usr/local/mrtg/bin/新建一个符号链接mrtgbin,这样可以少打些字, \r\n[root@MRTG /]# /mrtgbin/cfgmaker public@172.16.30.3 --global \"workdir: /mrtg\" --output=/mrtg/sr8812.cfg\r\n修改配置文件:已在root目录下\r\n#vi mrtg/lxy.cfg\r\n将\r\n#Options[_]: growright, bits前面的#去掉,靠左对齐并修改为Options[_]: growright, bytes ,提示“bytes”是unknown,原来不可以像windows下使用bytes,还换回原来的bits。\r\n在最后加上Language: GB2312,然后wq保存。\r\n下来运行程序\r\n#/mrtgbin/mrtg /mrtg/sr8812.cfg\r\n[root@MRTG mrtg]# /mrtgbin/mrtg /mrtg/sr8812.cfg\r\n\r\n有警告,多运行几次,警告不再出现就ok了。\r\n# env LANG=C /mrtgbin/mrtg /mrtg/sr8812.cfg\r\n2008-06-03 09:05:07, Rateup WARNING: /usr/local/mrtg/bin/rateup could not read the primary log file for 172.16.30.3_268435465\r\n2008-06-03 09:05:07, Rateup WARNING: /usr/local/mrtg/bin/rateup The backup log file for 172.16.30.3_268435465 was invalid as well\r\n2008-06-03 09:05:07, Rateup WARNING: /usr/local/mrtg/bin/rateup Can\'t remove 172.16.30.3_268435465.old updating log file\r\n2008-06-03 09:05:07, Rateup WARNING: /usr/local/mrtg/bin/rateup Can\'t rename 172.16.30.3_268435465.log to 172.16.30.3_268435465.old updating log file\r\n2008-06-03 09:05:07, Rateup WARNING: /usr/local/mrtg/bin/rateup could not read the primary log file for 172.16.30.3_268435473\r\n2008-06-03 09:05:07, Rateup WARNING: /usr/local/mrtg/bin/rateup The backup log file for 172.16.30.3_268435473 was invalid as well\r\n2008-06-03 09:05:07, Rateup WARNING: /usr/local/mrtg/bin/rateup Can\'t remove 172.16.30.3_268435473.old updating log file\r\n2008-06-03 09:05:07, Rateup WARNING: /usr/local/mrtg/bin/rateup Can\'t rename 172.16.30.3_268435473.log to 172.16.30.3_268435473.old updating log file\r\n2008-06-03 09:05:07, Rateup WARNING: /usr/local/mrtg/bin/rateup could not read the primary log file for 172.16.30.3_268435481\r\n2008-06-03 09:05:07, Rateup WARNING: /usr/local/mrtg/bin/rateup The backup log file for 172.16.30.3_268435481 was invalid as well\r\n2008-06-03 09:05:07, Rateup WARNING: /usr/local/mrtg/bin/rateup Can\'t remove 172.16.30.3_268435481.old updating log file\r\n2008-06-03 09:05:07, Rateup WARNING: /usr/local/mrtg/bin/rateup Can\'t rename 172.16.30.3_268435481.log to 172.16.30.3_268435481.old updating log file\r\n2008-06-03 09:05:07, Rateup WARNING: /usr/local/mrtg/bin/rateup could not read the primary log file for 172.16.30.3_268435489\r\n2008-06-03 09:05:07, Rateup WARNING: /usr/local/mrtg/bin/rateup The backup log file for 172.16.30.3_268435489 was invalid as well\r\n2008-06-03 09:05:07, Rateup WARNING: /usr/local/mrtg/bin/rateup Can\'t remove 172.16.30.3_268435489.old updating log file\r\n2008-06-03 09:05:07, Rateup WARNING: /usr/local/mrtg/bin/rateup Can\'t rename 172.16.30.3_268435489.log to 172.16.30.3_268435489.old updating log file\r\n2008-06-03 09:05:07, Rateup WARNING: /usr/local/mrtg/bin/rateup could not read the primary log file for 172.16.30.3_268435849\r\n2008-06-03 09:05:07, Rateup WARNING: /usr/local/mrtg/bin/rateup The backup log file for 172.16.30.3_268435849 was invalid as well\r\n2008-06-03 09:05:07, Rateup WARNING: /usr/local/mrtg/bin/rateup Can\'t remove 172.16.30.3_268435849.old updating log file\r\n2008-06-03 09:05:07, Rateup WARNING: /usr/local/mrtg/bin/rateup Can\'t rename 172.16.30.3_268435849.log to 172.16.30.3_268435849.old updating log file\r\n2008-06-03 09:05:07, Rateup WARNING: /usr/local/mrtg/bin/rateup could not read the primary log file for 172.16.30.3_335544329\r\n2008-06-03 09:05:07, Rateup WARNING: /usr/local/mrtg/bin/rateup The backup log file for 172.16.30.3_335544329 was invalid as well\r\n2008-06-03 09:05:07, Rateup WARNING: /usr/local/mrtg/bin/rateup Can\'t remove 172.16.30.3_335544329.old updating log file\r\n2008-06-03 09:05:07, Rateup WARNING: /usr/local/mrtg/bin/rateup Can\'t rename 172.16.30.3_335544329.log to 172.16.30.3_335544329.old updating log file\r\n2008-06-03 09:05:07, Rateup WARNING: /usr/local/mrtg/bin/rateup could not read the primary log file for 172.16.30.3_335544337\r\n2008-06-03 09:05:07, Rateup WARNING: /usr/local/mrtg/bin/rateup The backup log file for 172.16.30.3_335544337 was invalid as well\r\n2008-06-03 09:05:07, Rateup WARNING: /usr/local/mrtg/bin/rateup Can\'t remove 172.16.30.3_335544337.old updating log file\r\n2008-06-03 09:05:07, Rateup WARNING: /usr/local/mrtg/bin/rateup Can\'t rename 172.16.30.3_335544337.log to 172.16.30.3_335544337.old updating log file\r\n\r\n# env LANG=C /mrtgbin/mrtg /mrtg/sr8812.cfg\r\n2008-06-03 09:05:39, Rateup WARNING: /usr/local/mrtg/bin/rateup Can\'t remove 172.16.30.3_268435465.old updating log file\r\n2008-06-03 09:05:39, Rateup WARNING: /usr/local/mrtg/bin/rateup Can\'t remove 172.16.30.3_268435473.old updating log file\r\n2008-06-03 09:05:39, Rateup WARNING: /usr/local/mrtg/bin/rateup Can\'t remove 172.16.30.3_268435481.old updating log file\r\n2008-06-03 09:05:39, Rateup WARNING: /usr/local/mrtg/bin/rateup Can\'t remove 172.16.30.3_268435489.old updating log file\r\n2008-06-03 09:05:39, Rateup WARNING: /usr/local/mrtg/bin/rateup Can\'t remove 172.16.30.3_268435849.old updating log file\r\n2008-06-03 09:05:39, Rateup WARNING: /usr/local/mrtg/bin/rateup Can\'t remove 172.16.30.3_335544329.old updating log file\r\n2008-06-03 09:05:39, Rateup WARNING: /usr/local/mrtg/bin/rateup Can\'t remove 172.16.30.3_335544337.old updating log file\r\n\r\n# env LANG=C /mrtgbin/mrtg /mrtg/sr8812.cfg(不出错了)\r\n制作首页:\r\n #/mrtgbin/indexmaker --output=/mrtg/index.html --title=\" MRTG on linux\" mrtg/sr8812.cfg\r\n设定5分钟运行一次:\r\n#crontab -e 编辑模式输入\r\n*/5 * * * * /root/mrtgbin/mrtg /root/mrtg/sr8812.cfg\r\n保存\r\n然后reboot,\r\nhttp://192.168.1.30/mrtg 你应该就可以看到网络使用情况的曲线了。\r\n设置后中文显示始终是乱码,网上的几种解决方案都不成功,还是用E文吧。 \r\n如果你设置了中级防火墙而又没有开启80端口访问,需要编辑/etc/sysconfig/iptables允许别人访问80端口。\n\n[ 本帖最后由 fanoii 于 2008-6-3 18:48 编辑 ] |
|