监测Linux上面的流量MRTG-安装MRTG

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

  监测Linux上面的流量MRTG-安装MRTG

  本文讲述的是监测Linux上面的流量MRTG:前言安装MRTG准备工作安装MRTG

                       监测网路卡流量mrtg.cfg参数的含义监测CPU负载量

  开始安装 MRTG

  由于 MRTG 是透过 SNMP 通讯协定来要求资料,因此你的 Linux 上面需要先安装相关的软体,通常我们都是安装 ucd-snmp 这套软体的,那就来安装吧!

  下载 ucd-snmp-4.2.1.tar.gz, mrtg-2.9.17.tar.gz ;

  安装 ucd-snmp-4.2.1.tar.gz: [root @tsai /root]# cd /usr/local/src

  1.   [root @tsai src]# cp /root/ucd-snmp-4.2.1.tar.gz .  
  2.  
  3.   [root @tsai src]# tar -zxvf ucd-snmp-4.2.1.tar.gz  
  4.  
  5.   [root @tsai src]# cd ucd-snmp-4.2.1  
  6.  
  7.   [root @tsai ucd-snmp-4.2.1]# ./configure --prefix=/usr/local/snmp  
  8.  
  9.   .......(过程我就省略了)  
  10.  
  11.   ************** Configuration Section **************  
  12.  
  13.   You are about to be prompted by a series of questions. Answer  
  14.  
  15.   them carefully, as they determine how the snmp agent and related  
  16.  
  17.   applications are to function.  
  18.  
  19.   After the configure script finishes, you can browse the newly  
  20.  
  21.   created config.h file for further - less important - parameters to  
  22.  
  23.   modify. Be careful if you re-run configure though since config.h will  
  24.  
  25.   be over written.  
  26.  
  27.   -Press return to continue- (这裡按 enter 吧)  
  28.  
  29.   disabling above prompt for future runs... yes  
  30.  
  31.   checking System Contact Information...  
  32.  
  33.   *** System Contact Information:  
  34.  
  35.   Describes who should be contacted about the host the agent is  
  36.  
  37.   running on. This information is available in the MIB-II tree. This  
  38.  
  39.   Can Also Be Over-Ridden Using The "syscontact" Syntax In The Agent'S  
  40.  
  41.   Configuration Files.  
  42.  
  43.   System Contact Information (root@):root@tsai.adsldns.org (这裡输入你的 e-mail)  
  44.  
  45.   setting System Contact Information to... root@tsai.adsldns.org  
  46.  
  47.   checking System Location...  
  48.  
  49.   *** System Location:  
  50.  
  51.   Describes the location of the system. This information is  
  52.  
  53.   available in the MIB-II tree. This Can also be over-ridden using the  
  54.  
  55.   "syslocation" syntax in the agent's configuration files.  
  56.  
  57.   System Location (Unknown):RedHat 6.1 (这裡可以随便输入,不正确也没关係)  
  58.  
  59.   setting System Location to... RedHat 6.1  
  60.  
  61.   checking Location to write logfile...  
  62.  
  63.   *** Logfile location:  
  64.  
  65.   Enter the default location for the snmpd agent to dump  
  66.  
  67.   information & errors to. If not defined (enter the keyword "none"  
  68.  
  69.   at the prompt below) the agent will use stdout and stderr instead.  
  70.  
  71.   (Note: This value can be over-ridden using command line options.)  
  72.  
  73.   Location to write logfile (/var/log/snmpd.log):(按 enter 即可)  
  74.  
  75.   setting Location to write logfile to... /var/log/snmpd.log  
  76.  
  77.   checking Location to write persistent information...  
  78.  
  79.   *** snmpd persistent storage location:  
  80.  
  81.   Enter a directory for the snmp library to store persistent  
  82.  
  83.   data in the form of a configuration file.  
  84.  
  85.   Location to write persistent information (/var/ucd-snmp):(按 enter 即可)  
  86.  
  87.   [root @tsai ucd-snmp-4.2.1]# make  
  88.  
  89.   [root @tsai ucd-snmp-4.2.1]# make install  
  90.  

  上面输入的资讯,在进行 MRTG 的製图时,会显示在图表上面,不过,这也是可以改的资讯,所以,如果不小心输入错误也没关係的。这样就将 ucd-snmp 安装妥当了!

  启动 ucd-snmp :

  直接在 shell 下面打上 /usr/local/snmp/sbin/snmpd 即可!或者直接加在 /etc/rc.d/rc.local 当中,就可以自动开机时启动了!

  安装 MRTG

  1.    [root @tsai /root]# cd /usr/local/src  
  2.  
  3.   [root @tsai src]# cp /root/mrtg-2.9.17.tar.gz .  
  4.  
  5.   [root @tsai src]# tar -zxvf mrtg-2.9.17.tar.gz  
  6.  
  7.   [root @tsai src]# cd mrtg-2.9.17  
  8.  
  9.   [root @tsai mrtg-2.9.17]# ./configure --prefix=/usr/local/mrtg-2 \  
  10.  
  11.   > --with-gd=/usr/include \  
  12.  
  13.   > --with-gd-lib=/usr/lib \  
  14.  
  15.   > --with-gd-inc=/usr/include \  
  16.  
  17.   > --with-png=/usr/include \  
  18.  
  19.   > --with-zlib=/usr/include  
  20.  
  21.   [root @tsai mrtg-2.9.17]# make; make install  
  22.  

  [root @tsai mrtg-2.9.17]# mkdir /usr/local/apache/htdocs/mrtg (请注意,这裡与你的 WWW 主页的放置地点有关,请依你的系统来设定,另外,由于我们需要设定 网路流量、CPU与RAM使用率,因此在 mrtg 中,可以再建立叁个子目录,比较容易管理啦!)

  1.   [root @tsai mrtg-2.9.17]# mkdir /usr/local/apache/htdocs/mrtg/net  
  2.  
  3.   [root @tsai mrtg-2.9.17]# cp images/* /usr/local/apache/htdocs/mrtg/net (将一些影像档拷贝到即将使用的目录中去备用)  
  4.  

  就样就安装妥当了!再来就是开始要设定 MRTG 的组态啰!

【编辑推荐】

RedHat上安装MRTG监控本机网卡流量

Linux下的mrtg使用

cacti 汇总流量图-将数据合并后作图

责任编辑:zhaolei 来源: vbird
相关推荐

2011-03-30 11:34:26

流量MRTG

2011-03-30 11:31:10

MRTG

2011-03-30 11:31:10

MRTG

2011-03-30 13:29:49

MRTG

2011-03-30 11:31:10

MRTG

2011-03-31 11:14:29

MRTG监测

2011-03-31 13:40:48

MRTGsquid流量

2011-03-31 10:24:15

2010-06-01 10:32:04

linux Mrtg

2010-06-01 11:20:39

Mrtg window

2011-04-01 09:18:03

FreeBSD安装MRTG

2010-06-01 12:51:00

2011-03-30 13:29:55

MRTG

2010-06-01 14:30:06

Mrtg教程

2011-03-31 11:14:28

2011-03-31 11:20:10

MRTG监测

2011-03-31 11:14:30

MRTG监测

2011-03-31 11:14:29

MRTG监测

2011-03-30 13:40:21

MRTG

2011-03-30 13:29:51

MRTG
点赞
收藏

51CTO技术栈公众号