MRTG的安装配置

运维 系统运维 系统
MRTG的安装配置:MRTG是一个监控网络链路流量负载的工具软件,通过snmp协议得到设备的流量信息,并将流量负载以包含PNG格式的图形的HTML 文档方式显示给用户,以非常直观的形式显示流量负载。本文讲述的是MRTG的安装配置

  MRTG安装配置

  大纲:

  1.安装perl(最好是5.6版本).

  2.安装MRTG,可以使用用mrtg-2.9.17.zip或者mrtg-2.9.29.zip 。在win32中的文件应该包含一个rateup.exe 。

  安装:

  1.解压MRTG到c:\mrtg-2.9.17目录下

  2.安装perl,你要确信perl的系统目录路径跟下面列出的一致:

  1.   C:\Perl\bin;%SystemRoot%\system32;%SystemRoot%;...  
  2.  

  你可以到控制面板--系统--环境变量中看到这些信息。

  如果你安装好了,可以在命令提示符下,到C:\mrtg-2.10.15\bin目录下,输入:

  1.   perl mrtg  
  2.  

  系统会给你一个正常的错误信息,需要一个MRTG的配置文件:

  1.   Usage: mrtg   
  2.  
  3.   mrtg-2.9.17 is the Multi Router Traffic Grapher.  
  4.  
  5.   If you want to know more about this tool, you might want  
  6.  
  7.   to read the docs. They came together with mrtg!  
  8.  
  9.   Home: http://people.ee.ethz.ch/~oetiker/webtools/mrtg/  
  10.  

  配置MRTG:

  首先应该建立一个MRTG的配置文件,你需要知道下面的一些信息:

  1.了解你要监控的设备ip地址或者主机名,snmp的端口号码(如果不是标准的端口号码);

  2.如果你想监控其它的输入输出字节,还需要知道设备得的SNMPOID

  3.最好你还必须了解SNMP的只读团体字符串

  现在用一个例子说明一下:设备ip为10.56.57.38,我们将监控流量和CPU负载

  1.首先我们设置MRTG的默认配置文件,在命令提示符下,进入到C:\mrtg-2.10.15\bin 目录下,输入下面命令:

  perl cfgmaker public@10.56.57.38 --global "WorkDir: c:\InetPub\wwwroot\MRTG" --output mrtg.cfg  这样就建立了一个初始的配置文件,注意这个文件中设备所有接口的存储号码。当你重配置你的设备时这些号码可能会被改变,因此你可以使用cfgmaker描述一些接口。

  1.   C:\mrtg-2.9.17\mrtg-2.9.17\bin>perl cfgmaker public@10.56.57.73 --global "WorkDir: C:\flow\mrtg\test" --output mrtg.cfg  
  2.  
  3.   --base: Get Device Info on public@10.56.57.38:  
  4.  
  5.   --base: Vendor Id:  
  6.  
  7.   --base: Populating confcache  
  8.  
  9.   --snpo: confcache public@10.56.57.38: Descr MS TCP Loopback interface  
  10.  
  11.   --snpo: confcache public@10.56.57.38: Descr VMware Virtual Ethernet Adapter --> 
  12.  

  2

  1.   --snpo: confcache public@10.56.57.38: Descr VMware Virtual Ethernet Adapter --> 
  2.  

  3 (duplicate)

  1.   --snpo: confcache public@10.56.57.38: Descr Intel 8255x-based Integrated Fast Et  
  2.  
  3.   hernet  
  4.  
  5.   --snpo: confcache public@10.56.57.38: Ip 10.56.57.38 --> 16777221  
  6.  
  7.   --snpo: confcache public@10.56.57.38: Ip 127.0.0.1 --> 1  
  8.  
  9.   --snpo: confcache public@10.56.57.38: Ip 192.168.198.1 --> 3  
  10.  
  11.   --snpo: confcache public@10.56.57.38: Ip 192.168.240.1 --> 2  
  12.  
  13.   --snpo: confcache public@10.56.57.38: Type 24 --> 1  
  14.  
  15.   --snpo: confcache public@10.56.57.38: Type 6 --> 2  
  16.  
  17.   --snpo: confcache public@10.56.57.38: Type 6 --> 3 (duplicate)  
  18.  
  19.   --snpo: confcache public@10.56.57.38: Type 6 --> 16777221 (duplicate)  
  20.  
  21.   --snpo: confcache public@10.56.57.38: Eth --> 1  
  22.  
  23.   --snpo: confcache public@10.56.57.38: Eth 00-50-56-c0-00-08 --> 2  
  24.  
  25.   --snpo: confcache public@10.56.57.38: Eth 00-50-56-c0-00-01 --> 3  
  26.  
  27.   --snpo: confcache public@10.56.57.38: Eth 00-a0-c9-25-ba-9d --> 16777221  
  28.  
  29.   --base: Get Interface Info  
  30.  
  31.   --base: Walking ifIndex  
  32.  
  33.   --base: Walking ifType  
  34.  
  35.   --base: Walking ifSpeed  
  36.  
  37.   --base: Walking ifAdminStatus  
  38.  
  39.   --base: Walking ifOperStatus  
  40.  
  41.   --base: Writing mrtg.cfg  
  42.  

  现在基本MRTG配置文件建立,你进入C:\mrtg-2.10.15\bin 目录下输入下面的命令看一下结果:

  1.   perl mrtg mrtg.cfg  
  2.  

  现在你就可以通过web查看到一些流量信息。

  使MRTG实时运行:

  现在我们希望让他实时运行,我们需要对他的配置文件进行设置。我们在mrtg.cfg中添加以下参数,使其每隔五分钟就的采集一次信息。

  增加选项

  1.   RunAsDaemon: yes  
  2.  
  3.   Interval:5  
  4.  

  生成主页面:

  1.   perl indexmaker --output=C:\flow\mrtg\test\index.html mrtg.cfg  
  2.  

  (运行MRTG:

  1. perl mrtg --logging=mrtg.log mrtg.cfg  

  使用web访问http://127.0.0.1/MRTG/index.htm看MRTG是否正常生成统计页面。)

  到你的mrtg.cfg文件中并且开始运行:

  1.   start /DC:\mrtg-2.10.15\bin wperl mrtg --logging=eventlog mrtg.cfg  
  2.  

  如果你想停止的话,可以在任务管理器中终止wperl进程。

  假如你想在win启动时就启动MRTG,可以使用下面的信息:

  1.   Target: wperl mrtg --logging=eventlog mrtg.cfg  
  2.  
  3.   Start in: C:\mrtg-2.10.15\bin  
  4.  

  其使用firedaemon软件

  配置系统服务:

  1.添加srvany.exe服务

  1.   instsrv MRTG "C:\mrtg-2.10.15\bin\srvany.exe"  
  2.  

  2.配置srvany:

  在注册标HEKY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MRTG中添加parameters子键。在子键中添加以下项目:

  Application的字符串,内容为C:\Perl\bin\perl.exe

  AppDirectory的字符串,内容为C:\mrtg-2.10.15\bin\

  AppParameters的字符串,内容为mrtg --logging=mrtg.log mrtg.cfg

  3.在服务中启用MRTG服务即可实时监控指定主机信息

  MRTG的安装配置就介绍到这里了。

【编辑推荐】

MRTG使用方法(配置SNMP服务)

用MRTG监测交换机端口流量(图)

SNMP MRTG下的问题解答及技巧

责任编辑:zhaolei 来源: 52network.
相关推荐

2011-11-08 21:55:58

MRTG 配置

2011-04-02 14:21:46

MRTG安装

2011-04-01 15:00:35

2010-06-07 18:12:39

mrtg 安装

2011-03-31 10:31:18

Ubuntu安装MRTG

2011-03-31 09:02:22

Windows安装MRTG

2011-04-01 10:19:13

MrtgCISCO安装

2010-05-28 18:57:15

Mrtg配置

2010-06-01 10:45:02

Mrtg 安装

2010-06-01 09:51:11

2011-03-31 10:26:51

安装MRTG

2010-06-01 10:12:29

Mrtg配置

2011-03-25 13:40:28

Cacti安装配置

2011-04-02 15:26:51

Cacti安装

2011-03-31 10:31:18

MRTG配置

2011-04-02 15:17:59

2011-04-02 15:26:58

Cacti安装

2011-02-25 17:48:52

2010-06-07 11:22:28

2011-03-02 10:41:41

Vsftpd安装
点赞
收藏

51CTO技术栈公众号