#/usr/local/bin/mrtg /usr/local/etc/mrtg/mrtg.cfg
今天是为了熟悉了解MRTG这个软件而动用了两台服务器试验
一台是FB5.0,一台是FB4.9,由于ports安装都有不可以预期的问题,
现在只能用4.9的平台配置
配置过程参照
http://www.adj.idv.tw/server/linux_freebsd.php#mrtg
软件包
mrtg-2.9.29_3,1.tgz
gd-2.0.15_1,1.tgz
jpeg-6b_1.tgz
p5-SNMP_Session-0.95.tgz
png-1.2.5_2.tgz
mrtg-2.9.29.tar.gz(特殊用途)
--------------------------------------------------------------------------------------------------------------------
step:1(个人注解:这里是通过tgz安装,避免过多痛苦)
#pkg_add mrtg-2.9.29_3,1.tgz
--------------------------------------------------------------------------------------------------------------------
step:2(这里是定义一个很干净的配置文件,告诉这台机器的域名或者ip而已,具体内容可以自己加,有学习的快感)
#cd /usr/local/etc/mrtg
#cfgmaker mrtg@10.2.223.241 > mrtg.cfg
/--------------------------获得信息-----------------------------/
--base: Get Device Info on mrtg@10.2.223.241:
SNMP Error:
no response received
SNMPv1_Session (remote host: "10.2.223.241" [10.2.223.241].161)
community: "mrtg"
request ID: -1181492412
PDU bufsize: 8000 bytes
timeout: 2s
retries: 5
backoff: 1)
at /usr/local/lib/perl5/site_perl/5.005/SNMP_util.pm line 600
SNMPWALK Problem for 1.3.6.1.2.1.1 on mrtg@10.2.223.241:
at /usr/local/bin/cfgmaker line 709
/---------------------------------------------------------------------/
#ee mrtg.cfg
加入
Workdir: /usr/local/tomcat5/webapps/jsp-examples/mrtg
Language: gb2312
Options[_]: growright
个人注解:这里是如果产生来流量文件的安置地方
语言:简体中文
流量流向 从左到右
# indexmaker mrtg.cfg > /usr/local/tomcat5/webapps/jsp-examples/mrtg/index.htm(1)
任何数据文件都是通过http的网页显示的,这里定义了网页的具体位置
step:3
# tar zxvf mrtg-2.9.25.tar.gz
# cd mrtg-2.9.25
# cp -rf images/* /usr/local/tomcat5/webapps/jsp-examples/mrtg/
既然有了数据,当然要有图片作背景了,这里是把包包里面的图片拷到网页文件的同级目录
step:4
#/usr/local/bin/mrtg /usr/local/etc/mrtg/mrtg.cfg
启动,产生统计 看看可以启动么?
step:5
crontab -e
*/5 * * * * /usr/local/bin/mrtg /usr/local/etc/mrtg/mrtg.cfg
如果上面的命令可以使用,加入到定时启动统计
--------------------------------------------------------------------------------------------------------------------
备注
(1)这里的网页路径可以动态选择,
因为我是用tomcat支持的,所以目录是
/usr/local/tomcat5/webapps/jsp-examples/mrtg/
by hopesfish@2004-05-26