成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

FreeBsd下安裝和配置MRTG

系統(tǒng) Linux
FreeBsd下安裝和配置MRTG:MRTG是什么?MRTG(Multi Router Traffic Grapher)是一個監(jiān)控網(wǎng)絡(luò)鏈路流量負(fù)載的工具軟件,通過snmp協(xié)議得到設(shè)備的流量信息。本文講述的是:如何在FreeBsd下安裝和配置MRTG

  FreeBsdMRTG安裝和配置全過程

  由于MRTG 不象APACHE 那么龐大, 精密。所以決定用PORTS 安裝。

  首先要安裝的是SNMP ,因?yàn)镸RTG就是通過SNMP 監(jiān)視流量來制作成可視化圖表

  1.   pub# cd /usr/ports/net-mgmt/net-snmp/  
  2.  
  3.   pub# make install && make clean  
  4.  
  5.   pub# rehash  
  6.  

  測試一下

  1.   pub# snmpd  
  2.  
  3.   pub# ps waux |grep snmpd  
  4.  
  5.   root 614 0.0 0.8 5612 4308 ?? S 12:45AM 0:00.23 snmpd  
  6.  

  這一步好了,假如系統(tǒng)和PORTS TREE 本身沒問題 ,這一步也應(yīng)該沒問題

  接下來 就是PORTS 安裝MRTG

  1.   pub# cd /usr/ports/net-mgmt/mrtg/  
  2.  
  3.   pub# make install && make clean  
  4.  
  5.   pub#rehash  
  6.  

  測試一下

  1.   pub# mrtg  
  2.  
  3.   Usage: mrtg  
  4.  
  5.   mrtg-2.11.1 is the Multi Router Traffic Grapher.  
  6.  
  7.   If you want to know more about this tool, you might want  
  8.  
  9.   to read the docs. They came together with mrtg!  
  10.  

  看到這個就應(yīng)該是沒問題了

  做完上面以后

  最后就是配置工作 使MRTG 能為我們工作 ,這個是最“復(fù)雜”的一步 , 其實(shí)前面安裝也挺復(fù)雜的,只是借助了PORTS 才會覺得“簡單” 有機(jī)會可以全部編譯安裝試一下 以求深入理解MRTG && snmp

  1. 在WEB 發(fā)布目錄/pub/site 建立一mrtg 目錄,為的是能把生成的圖表發(fā)布在瀏覽器里面

  1.   pub# mkdir mrtg  
  2.  

  2. 編輯 snmpd.conf 文件在里面添加訪問用戶 ,以求能順利獲得snmp上面的流量信息 ,這一步一定要做 ,而且好象在freebsd 和red hat下面它們的信息不太一樣 ,也許是版本不一樣導(dǎo)致 ,我就是吃了悶虧 ,以為都是一樣 ,結(jié)果耗費(fèi)了很長時間

  1.   pub# cd /usr/local/share/snmp/  
  2.  
  3.   pub# ls  
  4.  
  5.   mib2c-data mib2c.iterate_access.conf  
  6.  
  7.   mib2c.access_functions.conf mib2c.mfd.conf  
  8.  
  9.   mib2c.array-user.conf mib2c.notify.conf  
  10.  
  11.   mib2c.check_values.conf mib2c.old-api.conf  
  12.  
  13.   mib2c.check_values_local.conf mib2c.scalar.conf  
  14.  
  15.   mib2c.column_defines.conf mibs  
  16.  
  17.   mib2c.column_enums.conf mrtg.prowork  
  18.  
  19.   mib2c.column_storage.conf snmp_perl.pl  
  20.  
  21.   mib2c.conf snmp_perl_trapd.pl  
  22.  
  23.   mib2c.create-dataset.conf snmpconf-data  
  24.  
  25.   mib2c.genhtml.conf snmpd.conf.example  
  26.  
  27.   mib2c.int_watch.conf mib2c.iterate.conf  
  28.  

  看一下里面有個 snmpd.conf.example , copy 一下

  1.   pub# cp snmpd.conf.example snmpd.conf  
  2.  

  這樣里面就有了 snmpd.conf 的配置文件了

  1.   pub# ee snmpd.conf  
  2.  

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

  #

  1.   # EXAMPLE.conf:  
  2.  
  3.   # An example configuration file for configuring the ucd-snmp snmpd ag  
  4.  

  #

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

  #

  1.   # This file is intended to only be an example. If, however, you want  
  2.  

  找一下

  1.   # sec.name source community  
  2.  
  3.   com2sec local localhost COMMUNITY  
  4.  
  5.   com2sec mynetwork NETWORK/24 COMMUNITY  
  6.  
  7.   rocommunity prowork  
  8.  

  在這個地方添加 ocommunity prowork

  添加在這里比較容易記憶 ,方便以后查找 ,它也可以放在其它的地方 ,注意不要在前面加 # ^_^ ,其中的prowork 就是等會我們要使用的訪問名字 ,

  這一步和別的朋友寫的文檔上面有點(diǎn)不太一樣 , 注意多點(diǎn)沒壞處

  2. 生成 mrtg 配置文件 ,用于初始化,獲取 snmp 信息

  1.   pub# cd /usr/local/etc/mrtg  
  2.  
  3.   pub# cfgmaker prowork@192.168.1.28 > mrtg.prowork  
  4.  
  5.   --base: Get Device Info on prowork@192.168.1.28:  
  6.  
  7.   --base: Vendor Id:  
  8.  
  9.   --base: Populating confcache  
  10.  
  11.   --snpo: confcache prowork@192.168.1.28: Descr vr0 --> 1  
  12.  
  13.   --snpo: confcache prowork@192.168.1.28: Descr lo0 --> 2  
  14.  
  15.   --snpo: confcache prowork@192.168.1.28: Type 6 --> 1  
  16.  
  17.   --snpo: confcache prowork@192.168.1.28: Type 24 --> 2  
  18.  
  19.   --snpo: confcache prowork@192.168.1.28: Ip 127.0.0.1 --> 2  
  20.  
  21.   --snpo: confcache prowork@192.168.1.28: Ip 192.168.1.28 --> 1  
  22.  
  23.   --snpo: confcache prowork@192.168.1.28: Eth 00-05-5d-a1-b6-7d --> 1  
  24.  
  25.   --snpo: confcache prowork@192.168.1.28: Eth --> 2  
  26.  
  27.   --base: Get Interface Info  
  28.  
  29.   --base: Walking ifIndex  
  30.  
  31.   --base: Walking ifType  
  32.  
  33.   --base: Walking ifAdminStatus  
  34.  
  35.   --base: Walking ifOperStatus  
  36.  

  出現(xiàn)以上信息就證明通過了

  在這個地方有幾點(diǎn)要注意, 一個是prowork@后面的 192.168.1.28 在很多時候盡量用IP地址來代替,當(dāng)然假如是放在公網(wǎng)上面的機(jī)器是動態(tài)IP 就不得不使用域名,那也是沒辦法的事情,總之目的就是要獲得要抓的網(wǎng)卡上面的流量,得要給MRTG知道是哪塊網(wǎng)卡才行 ,所以一定要給它正確的地址 。

  還有一個就是前面prowork@中的prowork ,這個就是在前面snmpd.conf 建立的訪問者拉 ,假如這個訪問者不存在或者是寫錯 就會出現(xiàn)

  1.   pub# cfgmaker com2sec@192.168.1.28 > mrtg.prowork  
  2.  
  3.   --base: Get Device Info on com2sec@192.168.1.28:  
  4.  
  5.   SNMP Error:  
  6.  
  7.   no response received  
  8.  
  9.   SNMPv1_Session (remote host: "192.168.1.28" [192.168.1.28].161)  
  10.  
  11.   community: "com2sec"  
  12.  
  13.   request ID: 1181035357  
  14.  
  15.   PDU bufsize: 8000 bytes  
  16.  
  17.   timeout: 2s  
  18.  
  19.   retries: 5  
  20.  
  21.   backoff: 1)  
  22.  
  23.   at /usr/local/lib/perl5/site_perl/5.005/SNMP_util.pm line 627  
  24.  
  25.   SNMPWALK Problem for 1.3.6.1.2.1.1 on com2sec@192.168.1.28::::::v4only  
  26.  
  27.   at /usr/local/bin/cfgmaker line 796  
  28.  
  29.   WARNING: Skipping com2sec@192.168.1.28: as no info could be retrieved  
  30.  

  這個上面的信息就是我錯誤理解snmpd.conf 導(dǎo)致出錯的信息

  3 .在正確生成 mrtg.prowork的配置文件后就該修改修改里面的

  內(nèi)容以求能符合自己的習(xí)慣 ,

  1.   pub# cat mrtg.prowork  
  2.  
  3.   # Created by  
  4.  
  5.   # /usr/local/bin/cfgmaker prowork@192.168.1.28  
  6.  
  7.   ### Global Config Options  
  8.  
  9.   # for UNIX  
  10.  
  11.   #這是設(shè)定要存放MRTG的信息發(fā)布頁面的路徑 ,也就是存放能  
  12.  
  13.   #打開頁面看流量信息頁面的那個地方  
  14.  
  15.   WorkDir: /pub/site/mrtg/  
  16.  
  17.   # or for NT  
  18.  
  19.   # WorkDir: c:\mrtgdata  
  20.  
  21.   ### Global Defaults  
  22.  
  23.   # to get bits instead of bytes and graphs growing to the right  
  24.  
  25.   # Options[_]: growright, bits  
  26.  
  27.   EnableIPv6: no  
  28.  

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

  1.   # System: pub.porwork.com.cn  
  2.  
  3.   # Description: FreeBSD pub.porwork.com.cn 4.11-STABLE FreeBSD 4.11-STABLE #5: Tue Apr i386  
  4.  
  5.   # Contact: Me  
  6.  
  7.   # Location: Right here, right now.  
  8.  

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

 

  1.  ### Interface 1 >> Descr: 'vr0' | Name: '' | Ip: '192.168.1.28' | Eth: '00-05-5d-a1-b6-7d' ###  
  2.  
  3.   Target[192.168.1.28_1]: 1:prowork@192.168.1.28:  
  4.  
  5.   SetEnv[192.168.1.28_1]: MRTG_INT_IP="192.168.1.28" MRTG_INT_DESCR="vr0" 
  6.  
  7.   MaxBytes[192.168.1.28_1]: 1250000  
  8.  
  9.   Title[192.168.1.28_1]: Traffic Analysis for 1 -- pub.porwork.com.cn  
  10.  
  11.   PageTop[192.168.1.28_1]:  
  12.  
  13.   System: pub.porwork.com.cn in Right here, right now.  
  14.  
  15.   Maintainer: Admin   
  16.  
  17.   Description: vr0  
  18.  
  19.   ifType: ethernetCsmacd (6)  
  20.  
  21.   ifName: prowork nic  
  22.  
  23.   Max Speed: 1250.0 kBytes/s  
  24.  
  25.   Ip: 192.168.1.28 (pub.porwork.com.cn)  
  26.  
  27.   ### Interface 2 >> Descr: 'lo0' | Name: '' | Ip: '127.0.0.1' | Eth: '' ###  
  28.  
  29.   ### The following interface is commented out because:  
  30.  
  31.   ### * it is a Software Loopback interface  
  32.  
  33.   ### * has a speed of 0 which makes no sense  
  34.  
  35.   #  
  36.  
  37.   # Target[192.168.1.28_2]: 2:prowork@192.168.1.28:  
  38.  
  39.   # SetEnv[192.168.1.28_2]: MRTG_INT_IP="127.0.0.1" MRTG_INT_DESCR="lo0" 
  40.  
  41.   # MaxBytes[192.168.1.28_2]: 0  
  42.  
  43.   # Title[192.168.1.28_2]: Traffic Analysis for 2 -- pub.porwork.com.cn  
  44.  
  45.   # PageTop[192.168.1.28_2]:  
  46.  
  47.   Traffic Analysis for 2 -- pub.porwork.com.cn  
  48.  
  49.   #  
  50.  
  51.   # System: pub.porwork.com.cn in Right here, right now.  
  52.  
  53.   # Maintainer: Me   
  54.  
  55.   # Description: lo0  
  56.  
  57.   # ifType: softwareLoopback (24)  
  58.  
  59.   # ifName:  
  60.  
  61.   # Max Speed: 0.0 Bytes/s  
  62.  
  63.   # Ip: 127.0.0.1 (localhost.porwork.com.cn)  
  64.  
  65.   #  
  66.  
  67.   Options[_]: growright, bits  
  68.  
  69.   Language:gb2312  
  70.  
  71.   WithPeak[_]: wmy  
  72.  

  藍(lán)色為修改的地方 紅色為添加的地方,這里面的內(nèi)容不是很難

  可以修改讓它符合自己的習(xí)慣因?yàn)槔锩嬗行?等會會在WEB頁面

  顯示出來

  注意的是任何指令左側(cè) 都不要有空格出現(xiàn) 否則會提示 :

  1.   ERROR: Line 8 ( WorkDir: /var/www/html/mrtg) in CFG file (mrtg)does not make sense  
  2.  

  這個一點(diǎn)都不假 ,不相信試試看

  4. 生成WEB 頁面 index.html

  1.   indexmaker --title 'prowork net' -output /pub/site/mrtg/index.html mrtg.prowork  
  2.  

  --title 為 index.html 的標(biāo)題 /pub/site/mrtg/為發(fā)布頁面的

  絕對路徑 mrtg.prowork 為配置文件

  這時候應(yīng)該在 /pub/site/mrtg/里面生成了一個配置頁面

  打開看的時候 ,應(yīng)該是看到有 幾個紅叉叉的頁面 并沒有預(yù)想

  的那樣 ,原因是差了最后一步 :運(yùn)行MRTG

  5.運(yùn)行 MRTG

  1.   pub# mrtg /usr/local/etc/mrtg/mrtg.prowork  
  2.  
  3.   Rateup WARNING: /usr/local/bin/rateup could not read the primary log file for 192.168.1.28_1  
  4.  
  5.   Rateup WARNING: /usr/local/bin/rateup The backup log file for 192.168.1.28_1 was invalid as well  
  6.  
  7.   Rateup WARNING: /usr/local/bin/rateup Can't remove 192.168.1.28_1.old updating log file  
  8.  
  9.   Rateup WARNING: /usr/local/bin/rateup Can't rename 192.168.1.28_1.log to 192.168.1.28_1.old updating log file  
  10.  
  11.   pub# mrtg /usr/local/etc/mrtg/mrtg.prowork  
  12.  
  13.   Rateup WARNING: /usr/local/bin/rateup Can't remove 192.168.1.28_1.old updating log file  
  14.  
  15.   pub# mrtg /usr/local/etc/mrtg/mrtg.prowork  
  16.  
  17.   pub# mrtg /usr/local/etc/mrtg/mrtg.prowork  
  18.  
  19.   pub# ls  
  20.  

  果然不假 ,真如別的朋友上面寫的一樣會“抱怨”三次

  到這一步 應(yīng)該是一個MRTG 該可以正常使用了

  就看到了令人驚奇的一面

  結(jié)尾:

  排程 ,因?yàn)榱髁渴遣蛔∽兓乃悦扛粢欢螘r間就要去探測

  一次 , 時間長了 精確度不夠 ,時間短 頻繁去探測 ,又會

  加重系統(tǒng)負(fù)擔(dān) , 別人告訴我 ,一般是 5-10分鐘 最佳

  1.   # mrtg crontab  
  2.  
  3.   */5 * * * * /usr/local/bin/mrtg /usr/local/etc/mrtg/mrtg.prowork  
  4.  

  到這里也就完全結(jié)束了。

【編輯推薦】

如何在FreeBSD下用MRTG監(jiān)測網(wǎng)路流量

MRTG的網(wǎng)絡(luò)流量監(jiān)測研究與應(yīng)用(應(yīng)用篇)

用MRTG監(jiān)測交換機(jī)端口流量(圖)

責(zé)任編輯:zhaolei 來源: prowork
相關(guān)推薦

2011-04-02 09:20:23

freebsdmrtg安裝

2011-04-01 09:18:03

FreeBSD安裝MRTG

2010-06-01 09:51:11

2010-05-28 18:57:15

Mrtg配置

2011-04-01 10:19:13

MrtgCISCO安裝

2011-03-31 10:31:18

Ubuntu安裝MRTG

2011-04-02 14:21:48

win安裝MRTG

2010-06-07 18:12:39

mrtg 安裝

2011-03-31 09:02:22

Windows安裝MRTG

2011-04-01 15:00:35

2011-04-02 14:21:46

MRTG安裝

2011-04-02 13:47:15

Debianmrtg配置

2011-03-31 09:02:18

MRTG流量

2011-04-01 14:48:29

配置SNMPMRTG

2011-11-08 21:55:58

MRTG 配置

2011-03-30 15:05:40

MRTG安裝

2010-06-01 09:25:14

Centos下安裝mr

2011-03-31 13:40:36

SNMPMRTG安裝

2011-04-06 10:03:08

2010-06-01 10:12:29

Mrtg配置
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號

主站蜘蛛池模板: 日韩国产中文字幕 | 成人看片在线观看 | 精品国产视频 | 91免费视频观看 | 亚洲欧美激情精品一区二区 | 一级黄色片免费在线观看 | 亚洲成人精品在线 | av高清 | 国产午夜精品一区二区三区四区 | 一级特黄a大片 | 在线免费观看欧美 | 国产视频一区在线 | 久久综合九色综合欧美狠狠 | 国产人成在线观看 | 国产欧美在线 | 精品一区二区久久久久久久网站 | av手机在线 | 成人午夜| 日韩欧美视频 | 国产精品成人在线 | 欧美中文字幕在线观看 | 日韩欧美在线播放 | 国产欧美一区二区三区在线播放 | 国产精品精品视频一区二区三区 | 欧美日韩国产一区二区三区 | 久久这里只有精品首页 | 久久9999久久| 欧美国产日韩在线观看 | 中文字幕亚洲视频 | 欧美久久久久 | 在线2区 | 久久99精品久久久久久国产越南 | 九九热精品视频 | 在线一区二区三区 | 91精品国产一区二区三区 | 欧美精品在线一区二区三区 | 高清视频一区二区三区 | 欧美精品在线播放 | 中文字幕亚洲视频 | 日本精品一区二区三区在线观看视频 | 亚洲一区二区久久 |