免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 881 | 回复: 0
打印 上一主题 下一主题

在RedHat9上安装调试MRTG监控本机网卡流量 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-04-26 09:48 |只看该作者 |倒序浏览

在RedHat9上安装调试MRTG监控本机网卡流量
系统环境:
redhat9.0
必备软件:
系统必须已经安装以下软件,这些软件都是光盘里自带的:
gd-1.8.4-11
libpng-1.2.2-16
perl-5.8.0-88
zlib-1.1.4-8
apache
gcc-3.2.2-5
1.首先来安装配置net-snmp
光盘里有net-snmp的安装rpm包,或者在添加/删除程序里选择安装ethereal-网络交通分析器,也会自动安装net-snmp软件包。
安装完以后,配置/etc/snmp/snmpd.conf文件,使其能配合mrtg工作。
把下面的#号去掉
#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
ok,改完以后,就可以启动snmpd服务
#/etc/rc.d/init.d/snmpd start
2.安装配置mrtg
tar zvxf mrtg-2.9.28.tar.gz
cd mrtg-2.9.28
./configure --prefix=/usr/local/mrtg \
--with-gd=/usr/include \
--with-gd-lib=/usr/lib \
--with-gd-inc=/usr/include \
--with-png=/usr/include \
--with-zlib=/usr/include &&
make &&
make install
3.配置mrtg
mkdir /usr/local/apache/htdocs/mrtg 这里/usr/local/apache/htdocs是www的默认主页地址,大家可能跟我不同
cp images/* /usr/local/apache/htdocs/mrtg images/*是在安装源文件夹里
/usr/local/mrtg/bin/cfgmaker --output=/usr/local/apache/htdocs/mrtg/mrtg.cfg public@192.168.0.1
创建一个mrtg.cfg文件在/usr/local/apache/htdocs/mrtg目录下,并且监控192.168.0.1的地址,本例这个地址是本机的网卡地址
然后修改mrtg.cfg文件,主要修改以下内容,以符合你的实际情况
WorkDir: /usr/local/apache/htdocs/mrtg
Options[_]: growright, bits
Language:GB2312
下面接着:
/usr/local/mrtg/bin/mrtg /usr/local/apache/htdocs/mrtg/mrtg.cfg
这个需要运行3次,前两次都会报错,不用去理会他,第3次就应该没有错误了,不过,若是有问题的话,就需要改mrtg.cfg,
再执行直到没有错误发生为止。
制作首页index.html:
/usr/local/mrtg/bin/indexmaker \
--output=/usr/local/apache/htdocs/mrtg/index.html \
--title=服务器流量统计 \
/usr/local/apache/htdocs/mrtg/mrtg.cfg
上面这个程序indexmaker是在制作首页。会自动地输出一个index.html的文件中。
使用手工运行mrtg并不能定时产生适当的统计信息,因此最好还是定时自动运行mrtg来生 成统计信息,默认为五分钟运行一次。
作为root身份crontab -e进入编辑状态,添加内容 如下:
*/5 * * * * /usr/local/mrtg/bin/mrtg /usr/local/apache/htdocs/mrtg/mrtg.cfg
ok!到此为止,配置完毕,记得一定要启动snmp和httpd服务哦!
访问:
http://192.168.0.1/mrtg/
就能看到网络流量图了
frank发表 于March 8, 2004 02:57 PM | 回复(8) | 引用(0)
回复
我的系统是linuxAS3,就是按上面的过程安装的,是编译时出现如下错误:
** Ooops, one of many bad things happened:
a) You don't have the GD library installed.
Get it from http://www.boutell.com, compile it and
use either --with-gd-lib=DIR and --with-gd-inc=DIR to specify
its location. You might also have to use --with-z-inc,
--with-z-lib and --with-png-inc, --with-png-lib for gd
versions 1.6 and higher. Check config.log for more
information on the problem.
b) You have the GD library installed, but not the gd.h
header file. Download the source (see above) and use
--with-gd-inc=DIR to specify where the file can be found.
c) You have the library and the header file installed, but
you also have a shared GD library in the same directory.
Remove the shared library files and/or links (e.g.
libgd.so.2.0.0, libgd.so and libgd.so.2). This is especially
likely if you're using a recent (post 1.8.4) version of GD
and didn't configure it with --disable-shared.
Consider following the instructions in doc/unix-guide.txt
怎么解决?
Posted by: 朱巍 at June 30, 2004 04:36 PM
建议将以下内容:
“/usr/local/mrtg/bin/cfgmaker --output=/usr/local/apache/htdocs/mrtg/mrtg.cfg public@192.168.0.1 “
改为:
“/usr/local/mrtg/bin/cfgmaker --global
"WorkDir:/usr/local/apache/htdocs/mrtg" --global "Options[_]:
bits,growright" --output=/usr/local/apache/htdocs/mrtg/mrtg.cfg
public@192.168.0.1 “
这样大概就不需要运行三次了,
这个需要运行3次,前两次都会报错,不用去理会他,第3次就应该没有错误了,不过,若是有问题的话,就需要改mrtg.cfg,
再执行直到没有错误发生为止。“
Posted by: 段 at May 25, 2004 05:27 PM
作为root身份crontab -e进入编辑状态,添加内容 如下:
*/5 * * * * /usr/local/mrtg/bin/mrtg /usr/local/apache/htdocs/mrtg/mrtg.cfg
這部門不知道怎麼弄了 求救
我都配置好但好像沒有抓到數據....急
哪位大哥能回復不 感激不儘
Posted by: liypan at April 20, 2004 12:55 PM
大家都来支持一下网上的好东西:)
Posted by: 风 at April 15, 2004 04:07 PM
你的网站做得很好,很实际,对于初学的人有很好的帮助,谢谢!
Posted by: 尤优 at March 30, 2004 11:59 PM
我在运行这个时出错 ./mrtg /usr/local/apache/htdocs/mrtg/mrtg.cfg
Malformed UTF-8 character (unexpected non-continuation byte 0x20,
immediately after start byte 0xcf) at
/usr/local/mrtg-2/bin/../lib/mrtg2/locales_mrtg.pm line 4997.
Malformed UTF-8 character (unexpected non-continuation byte 0x2e,
immediately after start byte 0xf0) at
/usr/local/mrtg-2/bin/../lib/mrtg2/locales_mrtg.pm line 5107.
ERROR: Creating templock /usr/local/apache/htdocs/mrtg/mrtg.cfg./mrtg_l_2084: No such file or directory at ./mrtg line
Posted by: 蛐蛐 at March 30, 2004 08:50 PM
很喜欢你的blog,从里面我学到了很多关于linux的知识,十分的感谢你,祝你的blog越做越好.:)
Posted by: 恍若如梦 at March 9, 2004 12:55 AM
今天是一个特殊的日子,很幸运能在你的这个网站上过了一个母亲节,你的网站很不错(发自内心的)希望你的网站在新的一年里给每个网络中的朋友带来乐趣!呵
呵,查点忘记了,在今天的日子里深深的祝福天下的母亲身体健康,家庭幸福!同时在这里希望和站长认识一下,我是来自大连的朋友!我的EMAIL
wallace888@linuxtt.com
Posted by: wallace at March 8, 2004 10:13 PM
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/17803/showart_104943.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP