Chinaunix首页 | 论坛 | 博客
  • 博客访问: 5283767
  • 博文数量: 1144
  • 博客积分: 11974
  • 博客等级: 上将
  • 技术积分: 12312
  • 用 户 组: 普通用户
  • 注册时间: 2005-04-13 20:06
文章存档

2017年(2)

2016年(14)

2015年(10)

2014年(28)

2013年(23)

2012年(29)

2011年(53)

2010年(86)

2009年(83)

2008年(43)

2007年(153)

2006年(575)

2005年(45)

分类: LINUX

2006-07-26 17:40:51

MRTG安装与配置

二〇〇五年七月四日   姜道友

本文仅供参考

 

一、       安装net-snmp包并配置snmpd.conf...................................................... 1

二、       安装软件包.......................................................................................... 1

三、       制作配置文件....................................................................................... 2

四、       生成主页.............................................................................................. 3

五、       修改httpd.conf文件:.......................................................................... 3

六、       参考资料:.......................................................................................... 3

1、    资料网站:................................................................................. 4

2、    自定义监控................................................................................. 4

3、    监控服务器CPU、内存、硬盘等配置资料.................................... 6

4、    big brother和rrdtool相关资料..................................................... 11

 
一、      安装net-snmp包并配置snmpd.conf

 

com2sec notConfigUser  default       xxx

group   notConfigGroup v1           notConfigUser

group   notConfigGroup v2c           notConfigUser

view    systemview    included   .1.3.6.1.2.1.1

view    systemview    included   .1.3.6.1.2.1.25.1.1

view all    included  .1

access notConfigGroup  ""      any       noauth    exact  all       none none

view mib2   included  .iso.org.dod.internet.mgmt.mib-2 fc

syslocation Unknown (edit /etc/snmp/snmpd.conf)

syscontact Root (configure /etc/snmp/snmp.local.conf)

pass .1.3.6.1.4.1.4413.4.1 /usr/bin/ucd5820stat

 
二、      安装软件包

gd及gd-devel、libpng、libpng-devel、perl等软件包

 

 
三、      制作配置文件

cfgmaker --global "WorkDir: /var/www/jiang" --global "Options[_]: growright,bits" --ifref=ip --output /etc/mrtg/mrtg.cfg xxxxx@202.x.x.x 

 

监控多个设备时使用:

 

cfgmaker --global "WorkDir: /var/www/html/mrtg"

--global "Options[_]: growright,bits"

--ifref=descr

--ifdesc=alias

public@router1.place.xyz

public@router2.place.xyz

--global "Options[_]: growright"

--ifref=name

--ifdesc=descr

public@switch1.place.xyz

--ifdesc=name

public@switch2.place.xyz > mrtg.cfg

 

这里的--global参数表示后面的选项是对后面指定的设备都是有效的(如果希望对多个设备进行监控时,该参数就会发生作用)。WorkDir用来指示 mrtg的工作目录;Options用来指定一些特定的选项,这里的growright,bits是用来指定默认options配置的,对于常见的应用来说默认options配置就可以满足需求了。ifref用来指示用什么选项来标识设备接口,这里指定使用IP地址来标识网络设备接口。ifref可以指定为nr、ip、eth、descr、name。nr表示用接口在MIBII库中Interface接口的ifIndex来识别接口;IP表示使用ip地址识别接口;eth表示使用接口的物理地址标识接口;descr表示使用接口的描述信息来标识接口;name表示使用接口名来标识接口。一般来说ip地址是唯一的,但是有些情况下接口是没有IP地址的,例如交换机就会出现这种情况。对于接口来说nr(接口号)是唯一的,因此对于一般情况使用IP地址就可以了,而对于其他一些情况则需要采用nr了。"--output /etc/mrtg.cfg"标识将生成的配置文件存放在/etc/目录下。"public@192.168.0.1"表示监控IP地址为 192.168.0.1的设备,采用public作为共同体名通过snmp协议来监控设备192.168.0.1。

 

 

       然后mrtg /etc/mrtg.cfg 运行3次

 
四、      生成主页

indexmaker /etc/mrtg/mrtg.cfg --output=/var/www/jiang/index.html
五、      修改httpd.conf文件:

Alias /jiang "/var/www/jiang"



    Options Indexes FollowSymLinks MultiViews

    AllowOverride None

    Order allow,deny

    Allow from all



然后在IE中: 即可浏览mrtg流量图

 
六、      参考资料:

 
1、         资料网站:

http://www.cublog.cn/u/6797/showart.php?id=25619

 
2、         自定义监控

 

Mrtg监测CPU

近日对mrtg感兴趣,参考鸟哥的资料后,整个过程如下笔记:
实验系统RedHat 9 in Linux Kernel 2.4.19
1.安装 sysstat-4.0.7-3.i386.rpm
rpm -ivh sysstat-4.0.7-3.i386.rpm

2.编写外挂脚本 vi mrtg.cpu
#!/bin/bash
# 这个程序是用来侦测 CPU 的小外挂程序!
# 1. 开始使用 sar 来监测 CPU 的 user 及 System 负载率
cpuusr=`/usr/bin/sar -u 1 3 | grep Average | awk '{print $3}'`
cpusys=`/usr/bin/sar -u 1 3 | grep Average | awk '{print $5}'`
UPtime=`/usr/bin/uptime | awk '{print $3 " " $4 " " $5}'`
# 2. 列出四个数据(前两个为数字)
echo $cpuusr
echo $cpusys
echo $UPtime
echo 192.168.8.38 #(这里写你的主机名称)

3.设定为可执行 chmod 755 mrtg.cpu
测试一下 ./mrtg.cpu
0.67
1.67
12:48, 1 user,
192.168.8.38

4.设置mrtg参数文件 vi mrtg.cfg.cpu
### Global Config Options
### To get bits instead of bytes and graphs growing to the right
WorkDir: /var/www/html/mrtg/cpu/
Language: GB2312
Target[192.168.8.38]: '/var/www/html/mrtg/cpu/mrtg.cpu'
MaxBytes[192.168.8.38]: 100
Options[192.168.8.38]: gauge, nopercent, growright
YLegend[192.168.8.38]: CPU loading (%)
ShortLegend[192.168.8.38]: %
LegendO[192.168.8.38]:   CPU 使用者负载;
LegendI[192.168.8.38]:   CPU 纯系统负载;
Title[192.168.8.38]: CPU 负载
PageTop[192.168.8.38]:

192.168.8.38 CPU 负载率




Kindgeorge'System: RedHat 9 in Linux Kernel 2.4.19


5.执行 (也三次以上)
mrtg /var/www/html/mrtg/cpu/mrtg.cfg.cpu

6.让它自动执行 crontab -e
*/2 * * * * mrtg /var/www/html/mrtg/cpu/mrtg.cfg.cpu >/dev/null 2>&1

7.打开浏览器即可观测

3、         监控服务器CPU、内存、硬盘等配置资料

1) CPU
  ################CPU######################
Target[cpu]: `/opt/mrtg/cpu.sh`
MaxBytes[cpu]: 12500000
Title[cpu]: CPU -- XMNLINUXTEST02
Options[cpu]: gauge,nopercent,growright
YLegend[cpu]: CPU loading (%)
ShortLegend[cpu]:%
LegendO[cpu]: & CPU USER;
LegendI[cpu]: & CPU SYSTEM;
PageTop[cpu]:

CPU  -- XMNLINUXTEST02


2)NIC 用配置文件自动配好的.
3)MEM  这个图最大设为2G,如果服务器有更大的内存,可以修改Maxbytes.
###############    MEM  2G  #################
Target[managemem]:`/opt/mrtg/mem.sh`
Unscaled[managemem]: dwym
MaxBytes[managemem]: 2048000
Title[managemem]:Memory
ShortLegend[managemem]: &
kmg[managemem]:kB,MB
kilo[managemem]:1024
YLegend[managemem]: Memory Usage
Legend1[managemem]: Total Memory
Legend2[managemem]: Used Memory
LegendI[managemem]: Total Memory
LegendO[managemem]: Used Memory
Options[managemem]: growright,gauge,nopercent
PageTop[managemem]:

Memory -------XMNLINUXTEST2


4)Swap   也是设为2G,根据实际情况改MaxBytes.
################### Swap  2G#######################
Target[swap]:`/opt/mrtg/swap.sh`
Unscaled[swap]: dwym
MaxBytes[swap]: 2048000
Title[swap]:Memory State of Server
ShortLegend[swap]: &
kmg[swap]:kB,MB
kilo[swap]:1024
YLegend[swap]: Swap Usage
Legend1[swap]: Total Swap
Legend2[swap]: Used Swap
LegendI[swap]: Total Swap
LegendO[swap]: Used Swap
Options[swap]: growright,gauge,nopercent
PageTop[swap]:

Swap-------XMNLINUXTEST02



5)设置磁盘使用量  最大为480G,可以根据实际情况修改MaxBytes
################## Disk Space  480G  #########################
Target[disk]: `/opt/mrtg/df.pl`
Title[disk]: Disk Space ----XMNLINUXTEST02
Unscaled[disk]: dwym
MaxBytes[disk]: 465247550
kmg[disk]: KB,MB,GB
LegendI[disk]: Total Disk Space
LegendO[disk]: Used Disk Space
Legend1[disk]: Total Disk Space
Legend2[disk]: Used Disk Space
YLegend[disk]:  Megabytes
ShortLegend[disk]: &
Options[disk]: growright,gauge,nopercent
PageTop[disk]:

Disk Space --------XMNLINUXTEST02


6)磁盘I/O的检测,如果需要的检,更多的分区,修改并复制这个部分,并修改diskperf.sh
################## Disk I/O 100K/sec  /DEV/SDA  ##########
# If you want monitor more disk, please copy below create
# now monitor job, and copy & modify the diskperf.sh to setting disk.
Target[diskIO]: `/opt/mrtg/diskperf.sh`
Title[diskIO]: Disk HDA I/O Utilization Report
Unscaled[diskIO]: dwym
MaxBytes[diskIO]: 100
PageTop[diskIO]:

Disk I/O Utilization Report


kmg[diskIO]: KB,MB,GB
LegendI[diskIO]: Disk I/O KBread/sec
LegendO[diskIO]: Disk I/O KBwrite/sec
Legend1[diskIO]: Disk I/O KBread/sec
Legend2[diskIO]: Disk I/O KBwrite/sec
YLegend[diskIO]:  Megabytes
ShortLegend[diskIO]: &
Options[diskIO]: growright,gauge,nopercent

 

4. 编译配置文件
先在/etc/profile 加入两个参数
LC_ALL=C
LANGUAGE=on

# env LANG=C /usr/bin/mrtg /var/www/html/mrtg/mrtg.cfg 
前面两次会出错,多运行几次就没有问题.
5. 生成html文件.
/usr/bin/indexmaker –output=/var/www/html/mrtg/index.html –title=主机名 /var/www/html/mrtg/mrtg.cfg
6. 配置apache 的设置.
#vi /etc/httpd/conf.d/mrtg.cfg
把Alias /mrtg /var/www/mrtg 改为Alias /mrtg /var/www/html/mrtg
把Allow from localhost  改为Allow from all
#service httpd restart ,重启apache.
7. 配置,自运行脚本,每五分钟自动运行一次.
在root 下启动 crontab –e 添加计划
    */5 * * * *  env LANG=C /usr/bin/mrtg /var/www/html/mrtg/mrtg.cfg
8.  确认service http&crontab的运进级别.
可以用下面两个命令查看这个服务的进行状况,
#chkconfig –list |grep httpd
#chkconfig –list |grep crontab
   或用设定运行级别
chkconfig --level 35 httpd on
chkconfig --level 35 crontab on

5. 常见问题
(1)问:实际内存或硬盘跟的图里面的值相差太多,要吗线超出图表,要吗,在图表的下面. 如何更改图表的比例? 如内存实际上只有512M,但表里面内存显示最大为2G.
答:修改/var/www/html/mrtg/mrtg.cfg 找到相关的部分, 修改MaxBytes[managemem]: 2048000 中的2048000为512000
(2)问:我有几个硬盘,如果要监测其他的硬盘IO?
 答:首先复制一份diskperf.sh 成diskperf2.sh ,再修改diskperf2.sh里面把hd=xxx改为你要监测的硬盘,再修改/var/www/html/mrtg/mrtg.cfg 复制sda的那一部门,并修改相关的部分.
如Target[diskIO]:`/opt/mrtg/diskperf.sh` 改成Target[diskIO]: `/opt/mrtg/diskperf2.sh`
  这一部份的[diskIO]改为disk2IO
(3)问:修改了配置文件/var/www/html/mrtg/mrtg.cfg 后,网页没有生效
 答:修改完配置文件应该要重新用下面命令生成新的网页.
/usr/bin/indexmaker –output=/var/www/html/mrtg/index.html –title=主机名 /var/www/html/mrtg/mrtg.cfg
       (4)问:如何看我的MRTG图.
         答:用http://你的IP/mrtg/ 就可以看到了.
  
附:1: mrtg.cfg 里面几个参数的意思.
Target:是要执行的脚本
Xsize:生成图表的横向宽度(最大600)
Ysize:生成图表的纵向高度(最大200)
Title:标题
kMG: Change the default multiplier prefixes
Ytics:纵向划分为几个块(格子)
MaxBytes:图表纵向数值的最大上限
PageTop:页面上面的提示
kilo:一般是写1024,如果需要的话,是1000在计算机里的单位
LegendI:从SHELL返回的数据中的第一个
LegendO:从SHELL返回的数据中的第二个
Options: growright,表示图表向右延展
附2:各个script
(1)
cat /opt/mrtg/cpu.sh
#!/bin/bash
cpuusr=`/usr/bin/sar -u 1 3 |grep Average |awk '{print }'`
cpusys=`/usr/bin/sar -u 1 3 |grep Average |awk '{print }'`
UPtime=`/usr/bin/uptime |awk '{print """"}'`
echo $cpuusr
echo $cpusys
echo $UPtime
hostname
(2)
Disk usage
cat /opt/mrtg/df.pl
#!/usr/bin/perl
# This script was written on Debian 3.0, it assumes that the command
# output(df -kl) looks like this:
# Filesystem           1k-blocks      Used Available Use% Mounted on
# /dev/md0              95645100  30401312  64272080  33% /
# /dev/hde1                14119      1159     12231   9% /boot
#
# In which case, this script returns :
# 95659219
# 30402503
# when run.
foreach $filesystem (`df -kl | grep -v "Filesystem"`)
{
 @df = split(/\s+/,$filesystem);
 $total += $df[1];
 $usage += $df[2];
}
print "$total\n";
print "$usage\n";
hostname
(3) DISK IO
]# cat /opt/mrtg/diskperf.sh
#!/bin/bash

# This script will monitor the KBread/sec &KBwriten/sec of Disk, and sent out the Blk_read/s and Blk_wrtn/s to MRTG, to make the performance image.
#   Creater: CCC IT loren  ext:2288   2005/8/3
# Set the who need monitor device. As sda ,sdb,sdc,sdd,hda.


# disk=sda
hd=sda
disk=/dev/$hd
UPtime=`/usr/bin/uptime |awk '{print """"}'`
KBread_sec=`iostat -x $disk|grep $hd |awk '{print }'`
KBwrite_sec=`iostat -x $disk|grep $hd |awk '{print }'`
echo "$KBread_sec"
echo "$KBwrite_sec"
hostname
(4)MEMORY
cat /opt/mrtg/mem.sh
#!/bin/bash
# run this script to check the mem usage.
totalmem=`/usr/bin/free |grep Mem |awk '{print }'`
usedmem=`/usr/bin/free |grep Mem |awk '{print }'`
echo "$totalmem"
echo "$usedmem"
(5)SWAP
cat /opt/mrtg/swap.sh
#!/bin/bash
# run this script to check the swap usage.
totalswap=`/usr/bin/free |grep Swap |awk '{print }'`
usedswap=`/usr/bin/free |grep Swap |awk '{print }'`
echo "$totalswap"
echo "$usedswap"

 
4、         big brother和rrdtool相关资料

介绍mrtg和rrdtools结合用的方法。

0.配置需要采集信息的服务器snmp服务(默认为机器已经装了,如果没有自己装去)
#vi /etc/snmp/snmpd.conf

在第三行加入
rocommunity public
public是snmp的识别名,默认为这个,一定要换成其它名称,在这里为了方便我还是用这个。(不换就会被黑客扫描到)

# /etc/rc.d/init.d/snmpd start //启动服务

1。radhat9.0 安装,安装时在系统管理内选择系统工具和网络工具
2。下载 # wget ftp://rpmfind.net/linux/redhat/9/en/...81-88.i386.rpm //一会有个外挂程序是perl的,会用到,而且库初始化也要用
3。下载 # wget ftp://rpmfind.net/linux/redhat/9/en/...17-13.i386.rpm //也可以用源码安装,不过这个简单就用他了

如果使用新版本请按照安装提示下载相应的包

5。# wget ftp://rpmfind.net/linux/freshrpms/re...-1.fr.i386.rpm

6。 安装
# rpm -ivh perl-CGI-2.81-88.i386.rpm
# rpm -ivh mrtg-2.9.17-13.i386.rpm
# rpm -ivh rrdtool-1.0.45-1.fr.i386.rpm

7。Mrtg数据采集:在mrtg.cfg中需要修改下列配置才能够将mrtg采集的数据保存到rrd库中
#vi /etc/mrtg/mrtg.cfg //用rpm安装,默认配置文件在这,也可以随意放
WorkDir: /var/www/html/mrtg/ //存放库文件的地方
Options[_]: growright,bits
Language: gb //语言,可以选择gb2312等好多种
#Refresh: 300 //下面的参数是可以选择开放的,先暂时屏蔽
#writeExpires: Yes
#RunAsDaemon: Yes
#Interval: 5
LogFormat: rrdtool //用rrdtool初始化
PathAdd:/usr/bin
LibAdd:/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/ //perl安装的路径

###################################################
在往下就是你要采集的服务器的信息了,例如要采集一个windows的流量信息

Target[202.103.***.***_16777219]: 16777219 ublic@202.103.***.***:
SetEnv[202.103.***.***_16777219]: MRTG_INT_IP="202.103.***.***" MRTG_INT_DESCR="202.103.***.***"
MaxBytes[202.103.***.***_16777219]: 12500000
Title[202.103.***.***_16777219]: Traffic Analysis for 16777219 -- ChangSha
PageTop[202.103.***.***_16777219]:

Traffic Analysis for 16777219 -- WAI-01


#######################################################

执行crontab -e加入

*/2 * * * * mrtg /etc/mrtg/mrtg.cfg

到此mrtg的配置基本结束,mrtg会每2分钟采样一次并将数据保存到rrd数据库中

如何知道采集客户端信息可以用以下方法:
# cfgmaker --output=/etc/mrtg/mrtg.cfg public@211.152.***.***
这种方法是直接输出客户端信息到mrtg.cfg中

一般情况我们可以这样:
# cfgmaker public@211.152.***.***
输出在屏幕上,然后把需要的信息拷贝到mrtg.cfg中,一般可用的端口前面没有注释(#),就拷那部分就行。

还可以自己编写采集信息的外挂程序
  可以应用安装完sysstat套件后产生的/usr/bin/sar程序进行外挂程序的编写,也可以使用bash写一个监测CPU的小程序。示例如下:

#vi cpu.sh
***************************************************************
#!/bin/sh
cpuusr=`/usr/bin/sar|grep Average|awk '{print$3}'`
cpusys=`/usr/bin/sar|grep Average|awk '{print$5}'`
UPtime=`/usr/bin/uptime | awk '{print $3" "$4" "$5}'`
echo $cpuusr
echo $cpusys
echo $UPtime
echo yourdomain

******************************************************************
*为文件内容,不要在sh中出现

# chmod 755 cpu.sh(设定成可执行)
# /etc/mrtg/cpu.sh(测试看可执行否)
输出:
2.0
  5.4
  1day,22:30,
  yourdomain

开始设定MRTG参数项,方法如下:
# vi cpu.cfg
************************************************************************

WorkDir: /var/www/html/mrtg/
Options[_]: growright,bits
Language: gb
MaxBytes[localhost]:100
Options[localhost]:gauge,nopercent,growright
#Refresh: 300
#writeExpires: Yes
#RunAsDaemon: Yes
#Interval: 5
LogFormat: rrdtool
PathAdd:/usr/bin
LibAdd:/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/

############添加部分###############
Target[localhost]:`/etc/mrtg/cpu.sh`
YLegend[localhost]: CPUloading(%)
ShortLegend[localhost]: %
LegendO[localhost]: CPU User;
LegendI[localhost]: CPU System;
Title[localhost]: 99_CPU
PageTop[localhost]:99_CPU

**************************************************************************
  这之后开始执行参数项,注意,要执行三次以上:
  # mrtg /etc/mrtg/cpu.cfg

写入到/etc/crontab当中:
  */5 * * * * mrtg /etc/mrtg/cpu.cfg
  这样就OK了,直接将Web指向地址就可以看见了。

还可以编写其它信息,例如磁盘应用情况,内存应用情况等等发,方法类似,就不介绍了。

到此为止,rrdtools就开始工作了,你可以自己编写一些脚本生成图片,编写方法可以看rrdtools的说明,下面我要介绍另一个经典的外挂程序,你可以不用编写就能生成图像,而且可以分组管理。


8. routers.cgi

为了能在web页面中显示我们的流量分析图,我们还需要下载routers.cgi这个用perl写的cgi文件,
从这里下载 ,

你需要首先安装GD
版本是2.06,
该版本需要GD
步骤如下:

# tar zxvf gd-2.0.11.tar.gz
# cd gd-2.0.11
# ./configure --prefix=/usr/local/gd;make;make install
# tar zxvf GD-2.0.6.tar.gz
# cd GD-2.0.6
# perl Makefile.PL

NOTICE: This module requires libgd 2.0.5 or higher.
it will NOT work with earlier versions.
For earlier versions of libgd, use GD version 1.41.

Where is libgd installed? [/usr/lib] /usr/local/gd/lib

Please choose the features that match how libgd was built:
Build JPEG support? [y] y //需要输入的地方
Build FreeType support? [y] n //需要输入的地方
Build XPM support? [y] n //需要输入的地方

If you experience compile problems, please check the @INC, @LIBPATH and @LIBS
arrays defined in Makefile.PL and manually adjust, if necessary.

Writing Makefile for GD

# make;make install
# tar zxvf routers2-v2.11.tar.Z
# cd routers2-v2.11
# perl install.pl //执行该命令后会要你回答一系列的问题,请根据你的系统情况如实填写

This program attempts to install the routers2.cgi package, located in
the current directory. It will attempt to identify system settings,
but you must confirm the locations guessed, or give the correct
information.
At any point, you can answer 'quit' to abort the installation.
Depending on your Perl implementation, you may also have line editing
and history capability.
Default answers are in square brackets before the prompt.
Continue [yes]?
Checking Perl libraries...
RRDs library found correctly.
WARNING: You do not have the GD Perl libraries installed correctly.
routers2.cgi will still run, but the Compact Summary display will not work.
Download the GD libraries from CPAN.org if required.
NT Users should use PPM to collect GD from ActiveState.
UNIX users should note that they need the GD.pm Perl library IN ADDITION to
the libgd.a C library.
Continue [y]?
WARNING: You do not have the Time::Zone library installed.
This is not a big problem, so don't worry.
This will only be a potential problem if you are using multiple time zones and
your operating system does not support the TZ environment variable.
If you wish to obtain this package, visit CPAN.org
WARNING: You do not have the Net::SNMP library installed.
This library is required if you wish to use the routingtable extension.
routers2.cgi will run correctly without this package, however.
If you wish to obtain this package, visit CPAN.org

FINDING OUT ABOUT YOUR SYSTEM

0. Attempting to identify your OS and web server...
- I think you are running under UNIX.
- I think you have Apache installed in
/etc/httpd/conf //apache安装的地方

1. Web server document root directory.
This is the base document directory of your web server.
Document root [/var/www/html]? //网站主目录

2. Web server CGI directory.
This is the directory where your web server keeps the CGI scripts.
CGI directory [/var/www/cgi-bin/]? //网站cgi目录

3. MRTG install directory.
This is the directory where your MRTG configuration files are kept
MRTG config directory? /etc/mrtg //你的mrtg的配置文件存放地

4. MRTG config files.
This is the wildcarded filename format for your MRTG configuration files.
Use a '*' to mean 'any characters' - for example, '*.cfg' or '*/*.conf'.
MRTG files [*.cfg]? //mrtg配置文件的格式(后缀)

5. RRD Database directory.
This is the directory where your .rrd files are kept
RRD directory [/var/www/html/mrtg/]? //存放rrd库的地方,在你的mrtg配置文件里设的

6. Perl executable.
This is the full pathname of where the Perl executable file is kept.
Perl executable [/usr/bin/perl]? //默认

7. routers2.cgi configuration file
This is the file that will hold the routers2.cgi configuration. Unless you
have a reason to move it, stick with the default.
If this file already exists, I will ask before overwriting it!
Configuration file [/var/www/html/mrtg/routers2.conf]? /var/www/html/mrtg/routers2.conf
//你的外挂脚本配置文件存放位置
ASKING OPTIONS
1. Net::SNMP does not appear to be installed. Extensions disabled.
If you subsequently install Net::SNMP, then you can enable the extensions
in the routers2.conf file.

2. GD does not appear to be installed. This is required for the compact
summary screen to work. If you intend to install it later, answer YES.
Otherwise, answer NO.
Activeate Compact Summary screen [no]? yes //需要GD

3. How big should 1K and 1M be? This is the 'usebigk' parameter from the
routers2.conf file. You have three options - 'yes', 'no' and 'mixed'.
yes -> 1K=1024, 1M=1024x1024
no -> 1K=1000, 1M=1000x1000
mixed -> 1K=1024, 1M=1024x1000 (dont ask)
'usebigk' option [mixed]? yes //选择流量计算方法

4. Can I attempt to send an email to the author to let him know that the
software has been installed? This will only give your routers.cgi version,
Perl version, and Operating System version.
Can I mail [yes]?

INSTALLING SOFTWARE

Perl is : /usr/bin/perl
MRTG files : /etc/mrtg/*.cfg
RRD files : /var/www/html/mrtg/
Doc root : /var/www/html
CGI bin : /var/www/cgi-bin/
Config file : /var/www/html/mrtg/routers2.conf
Extensions : INACTIVE
Compact page: ENABLED
'usebigk' : yes
Mail Steve : yes
Other options can be set later by modifying the Config file
Continue [yes]?
WARNING: /var/www/html/mrtg/routers2.conf already exists!
Overwrite existing file [no]? yes
Creating /var/www/html/mrtg/routers2.conf...
No Mail::Send available, trying sendmail instead.
/usr/sbin/sendmail: invalid option -- U
/usr/sbin/sendmail returned code 0. Looks like I cant send an email after all.


** ALL COMPLETE **

You should now be able to run the software, although you may need to
make sure you have your web server running.
To access the frontend, point your favourite web browser at the URL:


See for information on
how to say 'thanks' for this free software.

* Apache users should make sure that mod_expires is loaded and enabled
* Apache should also be configured with 'AllowOverride: All' for the directory
/var/www/html/graphs
* Apache users should NOT use mod_perl or speedycgi for this script.
* You may wish to tighten the rights granted on the graphs directory
/var/www/html/graphs //图片输出位置

到此你的安装完成,如果出现的界面跟上面的不一样,说明你还有一些需要的包没有安装上,你可以根据提示安装,最常见的如libpng-devel-1.2.2-16.i386.rpm,libjpeg-devel-6b-26.i386.rpm没有安装。

如果安装通过,就可以访问“http://你的机器的IP/cgi-bin/rou...??分析图了

以后如果想修改routers2的配置可以直接修改routers2.conf文件。

 



 
阅读(2140) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~