自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

Freebsd下MRTG安裝和配置全過(guò)程

系統(tǒng) Linux
Freebsd下MRTG安裝和配置全過(guò)程:MRTG是一個(gè)監(jiān)控網(wǎng)絡(luò)鏈路流量負(fù)載的工具軟件,通過(guò)snmp協(xié)議得到設(shè)備的流量信息,并將流量負(fù)載以包含PNG格式的圖形的HTML 文檔方式顯示給用戶,本文講述的是Freebsd下MRTG安裝和配置全過(guò)程

  Freebsdmrtg安裝和配置全過(guò)程

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

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

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

  測(cè)試一下

  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 本身沒(méi)問(wèn)題 ,這一步也應(yīng)該沒(méi)問(wèn)題

  接下來(lái) 就是PORTS 安裝MRTG

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

  測(cè)試一下

  pub# mrtg

  Usage: mrtg

  mrtg-2.11.1 is the Multi Router Traffic Grapher.

  If you want to know more about this tool, you might want

  to read the docs. They came together with mrtg!

  Home: http://people.ee.ethz.ch/~oetiker/webtools/mrtg/

  看到這個(gè)就應(yīng)該是沒(méi)問(wèn)題了

  做完上面以后

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

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

  1.   pub# mkdir mrtg  
  2.  

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

  pub# cd /usr/local/share/snmp/

  pub# ls

  mib2c-data mib2c.iterate_access.conf

  mib2c.access_functions.conf mib2c.mfd.conf

  mib2c.array-user.conf mib2c.notify.conf

  mib2c.check_values.conf mib2c.old-api.conf

  mib2c.check_values_local.conf mib2c.scalar.conf

  mib2c.column_defines.conf mibs

  mib2c.column_enums.conf mrtg.owshine

  mib2c.column_storage.conf snmp_perl.pl

  mib2c.conf snmp_perl_trapd.pl

  mib2c.create-dataset.conf snmpconf-data

  mib2c.genhtml.conf snmpd.conf.example

  mib2c.int_watch.conf mib2c.iterate.conf

  看一下里面有個(gè) snmpd.conf.example , copy 一下

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

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

  pub# ee snmpd.conf

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

  #

  # EXAMPLE.conf:

  # An example configuration file for configuring the ucd-snmp snmpd ag

  #

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

  #

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

  ............................................

  找一下

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

  在這個(gè)地方添加 rocommunity owshine

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

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

  修改完配制記得重起SNMPD

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

  pub# cd /usr/local/etc/mrtg

  pub# cfgmaker owshine@192.168.1.28 > mrtg.owshine

  --base: Get Device Info on owshine@192.168.1.28:

  --base: Vendor Id:

  --base: Populating confcache

  --snpo: confcache owshine@192.168.1.28: Descr vr0 --> 1

  --snpo: confcache owshine@192.168.1.28: Descr lo0 --> 2

  --snpo: confcache owshine@192.168.1.28: Type 6 --> 1

  --snpo: confcache owshine@192.168.1.28: Type 24 --> 2

  --snpo: confcache owshine@192.168.1.28: Ip 127.0.0.1 --> 2

  --snpo: confcache owshine@192.168.1.28: Ip 192.168.1.28 --> 1

  --snpo: confcache owshine@192.168.1.28: Eth 00-05-5d-a1-b6-7d --> 1

  --snpo: confcache owshine@192.168.1.28: Eth --> 2

  --base: Get Interface Info

  --base: Walking ifIndex

  --base: Walking ifType

  --base: Walking ifAdminStatus

  --base: Walking ifOperStatus

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

  在這個(gè)地方有幾點(diǎn)要注意, 一個(gè)是owshine@后面的 192.168.1.28 在很多時(shí)候盡量用IP地址來(lái)代替,當(dāng)然假如是放在

  公網(wǎng)上面的機(jī)器是動(dòng)態(tài)IP 就不得不使用域名,那也是沒(méi)辦法的事

  情,總之目的就是要獲得要抓的網(wǎng)卡上面的流量,得要給MRTG

  知道是哪塊網(wǎng)卡才行 ,所以一定要給它正確的地址 。

  還有一個(gè)就是前面owshine@中的owshine ,這個(gè)就是在前面

  snmpd.conf 建立的訪問(wèn)者拉 ,假如這個(gè)訪問(wèn)者不存在或者是

  寫錯(cuò) 就會(huì)出現(xiàn)

  1.   pub# cfgmaker com2sec@192.168.1.28 > mrtg.owshine  
  2.  

  --base: Get Device Info on com2sec@192.168.1.28:

  SNMP Error:

  no response received

  SNMPv1_Session (remote host: "192.168.1.28" [192.168.1.28].161)

  community: "com2sec"

  request ID: 1181035357

  PDU bufsize: 8000 bytes

  timeout: 2s

  retries: 5

  backoff: 1)

  at /usr/local/lib/perl5/site_perl/5.005/SNMP_util.pm line 627

  SNMPWALK Problem for 1.3.6.1.2.1.1 on com2sec@192.168.1.28::::::v4only

  at /usr/local/bin/cfgmaker line 796

  WARNING: Skipping com2sec@192.168.1.28: as no info could be retrieved

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

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

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

  pub# cat mrtg.owshine

  # Created by

  # /usr/local/bin/cfgmaker owshine@192.168.1.28

  ### Global Config Options

  # for UNIX

  #這是設(shè)定要存放MRTG的信息發(fā)布頁(yè)面的路徑 ,也就是存放能

  #打開(kāi)頁(yè)面看流量信息頁(yè)面的那個(gè)地方

  WorkDir: /pub/site/mrtg/

  # or for NT

  # WorkDir: c:\mrtgdata

  ### Global Defaults

  # to get bits instead of bytes and graphs growing to the right

  # Options[_]: growright, bits

  EnableIPv6: no

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

  # System: pub.porwork.com.cn

  # Descrīption: FreeBSD pub.porwork.com.cn 4.11-STABLE FreeBSD 4.11-STABLE #5: Tue Apr i386

  # Contact: Me

  # Location: Right here, right now.

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

  ### Interface 1 >> Descr: 'vr0' | Name: '' | Ip: '192.168.1.28' | Eth: '00-05-5d-a1-b6-7d' ###

  Target[192.168.1.28_1]: 1:owshine@192.168.1.28:

  SetEnv[192.168.1.28_1]: MRTG_INT_IP="192.168.1.28" MRTG_INT_DESCR="vr0"

  MaxBytes[192.168.1.28_1]: 1250000

  Title[192.168.1.28_1]: Traffic Analysis for 1 -- pub.porwork.com.cn

  PageTop[192.168.1.28_1]:

  Traffic Analysis for 1 -- pub.porwork.com.cn

  System: pub.porwork.com.cn in Right here, right now.

  Maintainer: Admin

  Descrīption: vr0

  ifType: ethernetCsmacd (6)

  ifName: owshine nic

  Max Speed: 1250.0 kBytes/s

  Ip: 192.168.1.28 (pub.porwork.com.cn)

  ### Interface 2 >> Descr: 'lo0' | Name: '' | Ip: '127.0.0.1' | Eth: '' ###

  ### The following interface is commented out because:

  ### * it is a Software Loopback interface

  ### * has a speed of 0 which makes no sense

  #

  # Target[192.168.1.28_2]: 2:owshine@192.168.1.28:

  # SetEnv[192.168.1.28_2]: MRTG_INT_IP="127.0.0.1" MRTG_INT_DESCR="lo0"

  # MaxBytes[192.168.1.28_2]: 0

  # Title[192.168.1.28_2]: Traffic Analysis for 2 -- pub.porwork.com.cn

  # PageTop[192.168.1.28_2]:

  Traffic Analysis for 2 -- pub.porwork.com.cn

  #

  # System: pub.porwork.com.cn in Right here, right now.

  # Maintainer: Me

  # Descrīption: lo0

  # ifType: softwareLoopback (24)

  # ifName:

  # Max Speed: 0.0 Bytes/s

  # Ip: 127.0.0.1 (localhost.porwork.com.cn)

  #

  Options[_]: growright, bits

  Language:gb2312

  WithPeak[_]: wmy

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

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

  顯示出來(lái)

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

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

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

  4. 生成WEB 頁(yè)面 index.html

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

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

  絕對(duì)路徑 mrtg.owshine 為配置文件

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

  打開(kāi)看的時(shí)候 ,應(yīng)該是看到有 幾個(gè)紅叉叉的頁(yè)面 并沒(méi)有預(yù)想

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

  5.運(yùn)行 MRTG

  1.   pub# mrtg /usr/local/etc/mrtg/mrtg.owshine  
  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.owshine  
  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.owshine  
  16.  
  17.   pub# mrtg /usr/local/etc/mrtg/mrtg.owshine  
  18.  
  19.   pub# ls  
  20.  

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

  到這一步 應(yīng)該是一個(gè)MRTG 該可以正常使用了http://www.owshine.com/mrtg

  就看到了令人驚奇的一面

  結(jié)尾:

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

  一次 , 時(shí)間長(zhǎng)了 精確度不夠 ,時(shí)間短 頻繁去探測(cè) ,又會(huì)

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

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

【編輯推薦】

MRTG安裝配置

MRTG—網(wǎng)絡(luò)監(jiān)控工具

將MRTG做成系統(tǒng)服務(wù)

責(zé)任編輯:zhaolei 來(lái)源: CSDN
相關(guān)推薦

2011-03-31 10:26:51

安裝MRTG

2011-02-22 10:46:02

Samba配置

2009-12-08 17:56:16

WCF配置

2011-04-01 09:18:03

FreeBSD安裝MRTG

2011-09-06 15:38:20

QT安裝

2011-01-21 17:51:52

2009-06-10 16:55:42

cygwin netb安裝

2010-03-10 13:24:45

Zend Debugg

2011-03-11 10:39:02

YUM安裝LAMP

2010-06-01 09:51:11

2010-05-13 16:15:21

MySQL5 mast

2010-03-26 14:48:03

Ylmf OS 2.0

2010-03-30 10:11:53

CentOS源

2010-11-19 09:30:29

2010-05-28 18:57:15

Mrtg配置

2011-04-01 10:19:13

MrtgCISCO安裝

2009-06-09 16:17:45

SQL Server

2011-04-18 15:56:10

軟件測(cè)試

2009-04-13 12:37:18

2009-12-02 13:02:20

Visual Stud
點(diǎn)贊
收藏

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