监测Linux上面的流量MRTG-安装MRTG
创始人
2024-07-24 15:31:50
0

  监测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 汇总流量图-将数据合并后作图

相关内容

热门资讯

如何允许远程连接到MySQL数... [[277004]]【51CTO.com快译】默认情况下,MySQL服务器仅侦听来自localhos...
如何利用交换机和端口设置来管理... 在网络管理中,总是有些人让管理员头疼。下面我们就将介绍一下一个网管员利用交换机以及端口设置等来进行D...
各种千兆交换机的数据接口类型详... 千兆交换机有很多值得学习的地方,这里我们主要介绍各种千兆交换机的数据接口类型,作为局域网的主要连接设...
施耐德电气数据中心整体解决方案... 近日,全球能效管理专家施耐德电气正式启动大型体验活动“能效中国行——2012卡车巡展”,作为该活动的...
Windows恶意软件20年“... 在Windows的早期年代,病毒游走于系统之间,偶尔删除文件(但被删除的文件几乎都是可恢复的),并弹...
规避非法攻击 用好路由器远程管... 单位在市区不同位置设立了科技服务点,每一个服务点的员工都通过宽带路由器进行共享上网,和单位网络保持联...
范例解读VB.NET获取环境变... VB.NET编程语言的使用范围非常广泛,可以帮助开发人员处理各种程序中的需求,而且还能对移动设备进行...
20个非常棒的扁平设计免费资源 Apple设备的平面图标PSD免费平板UI 平板UI套件24平图标Freen平板UI套件PSD径向平...