一、实验环境

参考教程:http://www.netmon.org/dummies.htm

http://www.docin.com/p-158415185.html

MRTG中文手册:http://bbs.chinaunix.net/thread-1344687-1-1.html

http://www.enterastream.com/whitepapers/mrtg/mrtg-manual-cap9.html

1.硬件平台

vmware workstation 8.05

Guest OS: 64bit windows server 2008 R2 SP1中文标准版-内存1GB

Host OS: 64bit windows 7 中文Home版

内存6GB

CPU:i5-2450m

2.所需软件

A. MRTG:

下载地址:http://oss.oetiker.ch/mrtg/pub/?M=D

版本:2.17.4

B.ActivePerl

下载地址:http://www.activestate.com/activeperl/downloads

版本:64bit 5.16.3

C.Microsoft® Windows® Server 2003 Resource Kit Tools

下载地址:http://www.microsoft.com/en-us/download/details.aspx?id=17657

3.实验拓扑:

2台虚拟机A和B

A: OS- windows server 2008 R2 作为DC

IP:192.168.190.168

B: OS – windows server 2008 R2 作为域内MRTG主机,用来监控主机A上的流量

IP:192.168.190.194

二、安装过程

1.安装两台VM上OS-略

2.server B加入域-略

3.server B上加入IIS服务器角色。后续步骤如果没注明,都在server B上操作

4..建立以下目录:

c:\inetpub\wwwroot\mrtg   -index.html目录

C:\MRTG\mrtg-2.17.4\          -mrtg执行文件目录

C:\MRTG\cfg                           -配置文件目录

C:\MRTG\reg                          -注册表存放目录

5.更改IIS默认网站目录为c:\inetpub\wwwroot\mrtg

6.解压MRTG2.17.4到C:\MRTG目录

7.安装ActivePerl.确保安装成功后环境变量增加路径c:\perl64\bin

8.安装windows 2003 Resource Tools.下载安装包,执行安装程序安装到默认路径C:\Program Files (x86)\Windows Resource Kits

9.增加server A上的SNMP功能特性

配置server A上的SNMP服务如下:

10.server B上配置MRTG,首先进入命令行模式(开始->运行->输入CMD)。进入C:\MRTG\mrtg-2.17.4\bin目录。输入如下指令:

10.1、perl cfgmaker public@192.168.190.168 --global "WorkDir: c:\inetpub\wwwroot\mrtg" --output c:\mrtg\cfgmrtg.cfg

(团体名为public,192.168.190.168为DC服务器的IP,c:\inetpub\wwwroot\mrtg为要生成的网页目录,同时也是在IIS中已经配置好的发布目录,完成该命令后会生成一个名为mrtg.cfg的配置文件)

注意 workdir后面有一个空格

输出:

C:\MRTG\mrtg-2.17.4\bin>perl cfgmaker --ifref=ip --ifdesc=descr --if-filter=$if_is_ethernet public@192.168.190.168
--global "WorkDir: c:\inetpub\wwwroot\mrtg" --output c:\mrtg\cfg\mrtg.cfg
--base: Get Device Info on public@192.168.190.168:
--base: Vendor Id: Unknown Vendor - 1.3.6.1.4.1.311.1.1.3.1.3
--base: Populating confcache
--base: Get Interface Info
--base: Walking ifIndex
--snpd:   public@192.168.190.168: -> 1 -> ifIndex = 1
--snpd:   public@192.168.190.168: -> 2 -> ifIndex = 2
--snpd:   public@192.168.190.168: -> 3 -> ifIndex = 3
--snpd:   public@192.168.190.168: -> 4 -> ifIndex = 4
--snpd:   public@192.168.190.168: -> 5 -> ifIndex = 5
--snpd:   public@192.168.190.168: -> 6 -> ifIndex = 6
--snpd:   public@192.168.190.168: -> 7 -> ifIndex = 7
--snpd:   public@192.168.190.168: -> 8 -> ifIndex = 8
--snpd:   public@192.168.190.168: -> 9 -> ifIndex = 9
--snpd:   public@192.168.190.168: -> 10 -> ifIndex = 10
--snpd:   public@192.168.190.168: -> 11 -> ifIndex = 11
--snpd:   public@192.168.190.168: -> 12 -> ifIndex = 12
--snpd:   public@192.168.190.168: -> 13 -> ifIndex = 13
--snpd:   public@192.168.190.168: -> 14 -> ifIndex = 14
--snpd:   public@192.168.190.168: -> 15 -> ifIndex = 15
--snpd:   public@192.168.190.168: -> 16 -> ifIndex = 16
--snpd:   public@192.168.190.168: -> 17 -> ifIndex = 17
--snpd:   public@192.168.190.168: -> 18 -> ifIndex = 18
--base: Walking ifType
--snpd:   public@192.168.190.168: -> 1 -> ifType = 24
--snpd:   public@192.168.190.168: -> 2 -> ifType = 131
--snpd:   public@192.168.190.168: -> 3 -> ifType = 131
--snpd:   public@192.168.190.168: -> 4 -> ifType = 131
--snpd:   public@192.168.190.168: -> 5 -> ifType = 23
--snpd:   public@192.168.190.168: -> 6 -> ifType = 6
--snpd:   public@192.168.190.168: -> 7 -> ifType = 6
--snpd:   public@192.168.190.168: -> 8 -> ifType = 6
--snpd:   public@192.168.190.168: -> 9 -> ifType = 23
--snpd:   public@192.168.190.168: -> 10 -> ifType = 131
--snpd:   public@192.168.190.168: -> 11 -> ifType = 131
--snpd:   public@192.168.190.168: -> 12 -> ifType = 6
--snpd:   public@192.168.190.168: -> 13 -> ifType = 131
--snpd:   public@192.168.190.168: -> 14 -> ifType = 6
--snpd:   public@192.168.190.168: -> 15 -> ifType = 6
--snpd:   public@192.168.190.168: -> 16 -> ifType = 6
--snpd:   public@192.168.190.168: -> 17 -> ifType = 6
--snpd:   public@192.168.190.168: -> 18 -> ifType = 6
--base: Walking ifAdminStatus
--snpd:   public@192.168.190.168: -> 1 -> ifAdminStatus = 1
--snpd:   public@192.168.190.168: -> 2 -> ifAdminStatus = 1
--snpd:   public@192.168.190.168: -> 3 -> ifAdminStatus = 1
--snpd:   public@192.168.190.168: -> 4 -> ifAdminStatus = 1
--snpd:   public@192.168.190.168: -> 5 -> ifAdminStatus = 1
--snpd:   public@192.168.190.168: -> 6 -> ifAdminStatus = 1
--snpd:   public@192.168.190.168: -> 7 -> ifAdminStatus = 1
--snpd:   public@192.168.190.168: -> 8 -> ifAdminStatus = 1
--snpd:   public@192.168.190.168: -> 9 -> ifAdminStatus = 2
--snpd:   public@192.168.190.168: -> 10 -> ifAdminStatus = 1
--snpd:   public@192.168.190.168: -> 11 -> ifAdminStatus = 1
--snpd:   public@192.168.190.168: -> 12 -> ifAdminStatus = 1
--snpd:   public@192.168.190.168: -> 13 -> ifAdminStatus = 1
--snpd:   public@192.168.190.168: -> 14 -> ifAdminStatus = 1
--snpd:   public@192.168.190.168: -> 15 -> ifAdminStatus = 1
--snpd:   public@192.168.190.168: -> 16 -> ifAdminStatus = 1
--snpd:   public@192.168.190.168: -> 17 -> ifAdminStatus = 1
--snpd:   public@192.168.190.168: -> 18 -> ifAdminStatus = 1
--base: Walking ifOperStatus
--snpd:   public@192.168.190.168: -> 1 -> ifOperStatus = 1
--snpd:   public@192.168.190.168: -> 2 -> ifOperStatus = 1
--snpd:   public@192.168.190.168: -> 3 -> ifOperStatus = 1
--snpd:   public@192.168.190.168: -> 4 -> ifOperStatus = 1
--snpd:   public@192.168.190.168: -> 5 -> ifOperStatus = 1
--snpd:   public@192.168.190.168: -> 6 -> ifOperStatus = 1
--snpd:   public@192.168.190.168: -> 7 -> ifOperStatus = 1
--snpd:   public@192.168.190.168: -> 8 -> ifOperStatus = 1
--snpd:   public@192.168.190.168: -> 9 -> ifOperStatus = 6
--snpd:   public@192.168.190.168: -> 10 -> ifOperStatus = 2
--snpd:   public@192.168.190.168: -> 11 -> ifOperStatus = 2
--snpd:   public@192.168.190.168: -> 12 -> ifOperStatus = 1
--snpd:   public@192.168.190.168: -> 13 -> ifOperStatus = 2
--snpd:   public@192.168.190.168: -> 14 -> ifOperStatus = 1
--snpd:   public@192.168.190.168: -> 15 -> ifOperStatus = 1
--snpd:   public@192.168.190.168: -> 16 -> ifOperStatus = 1
--snpd:   public@192.168.190.168: -> 17 -> ifOperStatus = 1
--snpd:   public@192.168.190.168: -> 18 -> ifOperStatus = 1
--base: Walking ifMtu
--snpd:   public@192.168.190.168: -> 1 -> ifMtu = 1500
--snpd:   public@192.168.190.168: -> 2 -> ifMtu = 4091
--snpd:   public@192.168.190.168: -> 3 -> ifMtu = 1460
--snpd:   public@192.168.190.168: -> 4 -> ifMtu = 1464
--snpd:   public@192.168.190.168: -> 5 -> ifMtu = 1494
--snpd:   public@192.168.190.168: -> 6 -> ifMtu = 1500
--snpd:   public@192.168.190.168: -> 7 -> ifMtu = 1500
--snpd:   public@192.168.190.168: -> 8 -> ifMtu = 1500
--snpd:   public@192.168.190.168: -> 9 -> ifMtu = 0
--snpd:   public@192.168.190.168: -> 10 -> ifMtu = 1480
--snpd:   public@192.168.190.168: -> 11 -> ifMtu = 1472
--snpd:   public@192.168.190.168: -> 12 -> ifMtu = 1500
--snpd:   public@192.168.190.168: -> 13 -> ifMtu = 1280
--snpd:   public@192.168.190.168: -> 14 -> ifMtu = 1500
--snpd:   public@192.168.190.168: -> 15 -> ifMtu = 1500
--snpd:   public@192.168.190.168: -> 16 -> ifMtu = 1500
--snpd:   public@192.168.190.168: -> 17 -> ifMtu = 1500
--snpd:   public@192.168.190.168: -> 18 -> ifMtu = 1500
--base: Walking ifSpeed
--snpd:   public@192.168.190.168: -> 1 -> ifSpeed = 1073741824
--snpd:   public@192.168.190.168: -> 2 -> ifSpeed = 1073741824
--snpd:   public@192.168.190.168: -> 3 -> ifSpeed = 1073741824
--snpd:   public@192.168.190.168: -> 4 -> ifSpeed = 1073741824
--snpd:   public@192.168.190.168: -> 5 -> ifSpeed = 1073741824
--snpd:   public@192.168.190.168: -> 6 -> ifSpeed = 1073741824
--snpd:   public@192.168.190.168: -> 7 -> ifSpeed = 1073741824
--snpd:   public@192.168.190.168: -> 8 -> ifSpeed = 1073741824
--snpd:   public@192.168.190.168: -> 9 -> ifSpeed = 0
--snpd:   public@192.168.190.168: -> 10 -> ifSpeed = 0
--snpd:   public@192.168.190.168: -> 11 -> ifSpeed = 100000
--snpd:   public@192.168.190.168: -> 12 -> ifSpeed = 1000000000
--snpd:   public@192.168.190.168: -> 13 -> ifSpeed = 100000
--snpd:   public@192.168.190.168: -> 14 -> ifSpeed = 1000000000
--snpd:   public@192.168.190.168: -> 15 -> ifSpeed = 1000000000
--snpd:   public@192.168.190.168: -> 16 -> ifSpeed = 1073741824
--snpd:   public@192.168.190.168: -> 17 -> ifSpeed = 1073741824
--snpd:   public@192.168.190.168: -> 18 -> ifSpeed = 1073741824
--base: Writing c:\mrtg\cfg\mrtg.cfg

CFG文件构成:


    10.2、perl indexmaker c:\mrtg\cfg\mrtg.cfg>c:\inetpub\wwwroot\mrtg\index.html
(使用INDEXMAKER将MRTG.CFG文件中的内容转换成index.html,方便我们进行浏览管理。)
    10.3、perl mrtg --logging=c:\mrtg\cfg\mrtg.log c:\mrtg\cfg\mrtg.cfg(从MRTG.CFG中读取配置并启动MRTG程序,同时记录日志信息到mrtg.log中)执行完后就会发现命令行模式开始实时监控。如图:

11.将程序以服务方式进行

step1:将c:\Program Files (x86)\Windows Resource Kits\Tools下instsrv.exe和Srvany.exe复制到mrtg安装目录的BIN目录下。例如c:\mrtg\mrtg-2.17.4\bin。

step2:在MRTG\mrtg-2.17.4\BIN目录下执行instsrv mrtg "c:\mrtg\mrtg-2.17.4\bin\srvany.exe"安装MRTG为系统服务。

step3:配置SRVANY,在注册表hkey_local_machine\system\currentcontrolset\services\mrtg中添加一个parameters项,再在parameters子键中添加以下项目:
Application的字串值,内容为c:\perl64\bin\wperl.exe  (wperl运行没有命令行控制台窗口)
AppDirectory的字串值,内容为c:\mrtg\mrtg-2.17.4\bin\
AppParameters的字串值,内容为mrtg --logging=c:\mrtg\cfg\mrtg.log c:\mrtg\cfg\mrtg.cfg

或者直接导入如下注册表文件wrtg.reg:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MRTG3\Parameters]
"Application"="c:\\perl64\\bin\\wperl.exe"
"AppParameters"="c:\\mrtg\\mrtg-2.17.4\\bin\\mrtg --logging=c:\\mrtg\\cfg\\eventlog c:\\mrtg\\cfg\\mrtg.cfg"
"AppDirectory"="c:\\mrtg\\mrtg-2.17.4\\bin\\"

step:4: 修改mrtg.cfg文件

添加:

 

Step5:到服务管理里头配置MRTG服务为自动

12.修改成中文标识:

例如68端口对应的中文名是“外网出口”,则用记事本打开index.htm,通过查找Traffic Analysis for 68将其替换为你所希望的中文名“外网出口”即可。

 

13.优化步骤10.1 cfgmaker,优化如下:

A:只显示指定的端口

perl cfgmaker --ifref=ip --ifdesc=descr --if-filter=$if_is_ethernet public@192.168.190.168 --global "WorkDir: c:\inetpub\wwwroot\mrtg" --output c:\mrtg\cfg\mrtg.cfg

修改前页面显示:

修改后:

B:放大图形

修改cfg文件

源文件:

### Interface 12 >> Descr: 'Intel(R)-PRO/1000-MT-Network-Connection' | Name: 'ethernet_5' | Ip: '192.168.190.168' | Eth: 'No Ethernet Id' ###

Target[192.168.190.168_192.168.190.168]: /192.168.190.168:public@192.168.190.168:
SetEnv[192.168.190.168_192.168.190.168]: MRTG_INT_IP="192.168.190.168" MRTG_INT_DESCR="Intel(R)-PRO/1000-MT-Network-Connection"
MaxBytes[192.168.190.168_192.168.190.168]: 125000000
Title[192.168.190.168_192.168.190.168]: Intel(R)-PRO/1000-MT-Network-Connection -- DC1.emmdemo.com
PageTop[192.168.190.168_192.168.190.168]: <h1>Intel(R)-PRO/1000-MT-Network-Connection -- DC1.emmdemo.com</h1>
增加:

Xsize[192.168.190.168_192.168.190.168]: 600
Ysize[192.168.190.168_192.168.190.168]: 100

重新构筑配置文件的批处理程序build.bat:

net stop mrtg3

del /q C:\inetpub\wwwroot\MRTG\*.*
perl cfgmaker public@192.168.190.168 --global "WorkDir: c:\inetpub\wwwroot\mrtg" --output c:\mrtg\cfgmrtg.cfg
perl indexmaker c:\mrtg\cfg\mrtg.cfg>c:\inetpub\wwwroot\mrtg\index.html
net start mrtg3

增加xsize后的效果:

去掉:

Xsize[192.168.190.168_192.168.190.168]: 600
Ysize[192.168.190.168_192.168.190.168]: 100

增加:

XScale[192.168.190.168_192.168.190.168]: 2.0
YScale[192.168.190.168_192.168.190.168]: 2.0

效果如下:

windows server 2008 R2上安装MRTG指南相关推荐

  1. IT:如何在Windows Server 2008 R2上安装Hyper-V虚拟化

    Windows Server 2008 R2 and later releases of the product ship with a virtualization platform called ...

  2. 在windows server 2008 R2上安装Bing Bar

    微软在msn toolbar 3.0的基础上,顺势推出了基于silverlight的Bing Bar,并将用Bing Bar取代msn toolbar. 可是微软写的明确,必须在Windows 7; ...

  3. 如何解决在Windows Server 2008 R2 上安装证书服务重启后出现 CertificationAuthority 91错误事件...

    很久都没写什么博客了,前一段时间学习2008 R2时,在自己的电脑上同时安装AD 和证书 往往会出现一个CertificationAuthority错误,如下: 产生问题的主要原因是: 证书服务器与D ...

  4. Windows server 2008 r2上安装MySQL

    根据自己的操作系统下载对应的32位或64位安装包.按如下步骤操作: MySQL数据库官网的下载地址http://dev.mysql.com/downloads/mysql, 第一步: 安装许可  双击 ...

  5. 在Windows Server 2008 R2上安装Ftp服务

    1.打开"管理工具"中的"服务器管理器" 2.在"服务器管理器"中,展开左侧列表"服务器管理器",在"角色&q ...

  6. 在Windows Server 2012 R2上安装Sharepoint 2013

        之前有在Windows Server 2008 r2上安装过Sharepoint 2013,后来因为虚拟机资源不足给删除了.现Sharepoint 2003升级至2013项目即将开始,需要重新 ...

  7. windows server 2008 R2 SP1安装WSUS问题 RRS feed Windows Server

    找到我这台机器的问题了.我的Windows Server 2008 R2上安装有 dotNet Framework 4.6.1.卸载之后,安装就正常了.原来WSUS 3.0 SP2的安装程序与新版本的 ...

  8. Windows Server 2008 R2 SP1 安装NET FrameWork 4.0 受阻滞问题解决办法。

    Windows Server 2008 R2 SP1 安装NET FrameWork 4.0 受阻滞问题解决办法. 参考文章: (1)Windows Server 2008 R2 SP1 安装NET ...

  9. windows server 2008 R2 SP1 安装SQL Server 2008 R2时提示 此操作系统不支持此版本的 SQL Server 版本...

    windows server 2008 R2 SP1 安装SQL Server 2008 R2时提示 "此操作系统不支持此版本的 SQL Server 版本" 原因: 安装的时候输 ...

最新文章

  1. 尚硅谷谷粒学院2020 高级篇代码_尚硅谷联合KubeSphere ,共同打造企业级云原生课程!...
  2. Activemq -- Spring 整合
  3. 深入分析MFC文档视图结构(项目实践)
  4. Linux vector最大存储数量,C++ STL vector容量(capacity)和大小(size)的区别
  5. dockerfile拉取私库镜像_关于kubernetes拉取私库镜像需要注意的点
  6. 安装axios指定版本
  7. windows设置定时自动关闭应用
  8. 【第2重磅】王者荣耀「绝悟」升级,全英雄池解禁
  9. 源代码转换成图-控制流图、数据流图
  10. HDU1922 POJ3004 Subway planning “神题”留名
  11. Pyflink系列之使用pyflink实现flink大数据引挚的经典案例wordcount
  12. 蛋糕究竟是怎样做大的
  13. Java SE基础知识详解第[12]期—集合(Set、Collections、Map、集合嵌套)
  14. Ubuntu 18.04 安装 deepin 微信
  15. 回复英文审稿人意见常用格式
  16. ServiceComb微服务框架
  17. MyEclipse中jer配置
  18. Modeling Task Relationships in Multi-task Learning withMulti-gate Mixture-of-Experts
  19. SQL由出生日期求年龄
  20. 未接响铃1秒是什么意思_90后秒选族是什么意思?90后秒选青年正追求梦想,并立即行动【图】...

热门文章

  1. 构建插件式的应用程序框架(六)----通讯机制(ZT)
  2. Java泛型进阶 - 如何取出泛型类型参数
  3. http协议进阶(三)http报文
  4. Java并发 -- JMM
  5. 奇奇怪怪的冒泡排序 TOJ 2014: Scramble Sort
  6. MYSQL注入天书之数据库增删改介绍
  7. CCAH-CCA-500-4题:Where are Hadoop task log files stored?
  8. CentOS 7部署OpenStack(9)—部署dashboard
  9. UIButton 的不同设置和UITextField 的默认值(修改默认值)
  10. CentOS7上编译多版本PHP并同时运行及systemd设置