全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:4405
推到 Plurk!
推到 Facebook!

MRTG網路流量統計分析適用於Microsoft NT或Unix各種作業統

 
jackkcg
站務副站長


發表:891
回覆:1050
積分:848
註冊:2002-03-23

發送簡訊給我
#1 引用回覆 回覆 發表時間:2002-07-17 23:22:52 IP:61.221.xxx.xxx 未訂閱
MRTG 安裝講義 -------------------------------------------------------------------------------- 安裝環境: RedHat 7.2 (Linux) 安裝日期:91.01.28 使用軟體及版本: 先要安裝gd,prel5 mrtg-2.9.17.tar.gz 下載網站:中山大學 ftp 站 取得原始碼 > cd /tmp (將 Mrtg的 gz 檔下載到 tmp 目錄,也可裝到其他目錄如:/usr/local/src) > ftp ftp.nsysu.edu.tw > cd /pub/Unix/Monitoring/mrtg (如要下載gd,也在Monitoring目錄下的gd來下載) > bin > get mrtg-2.9.17.tar.gz > bye 解開原始碼 > cd /tmp > tar zxvf mrtg-2.9.17.tar.gz 編譯 > cd /tmp > cd mrtg-2.9.17 > ./configure (預設路徑為/usr/local/mrtg-2,可下./configure --help查得) > make > make install 新增一mrtg目錄及複製圖形檔 cd /home/httpd/htdocs (Apache主網頁目錄) mkdir mrtg cd mrtg cp /tmp/mrtg-2.9.17/images/* . 設定及修改組態檔,及index.htm檔 > cd /usr/local/mrtg-2/bin > ./cfgmaker public@163.18.244.253 > mrtg.cfg (163.18.244.253為路由器或交換器的IP,且此設備支援SNMP) > vi mrtg.cfg > workdir: /home/httpd/htdocs/mrtg (修改workdir 的路徑到web目錄下,及修改相關的文字如:XX的流量) > ./mrtg mrtg.cfg(第一次執行時, 可能會有很多 Warning 的訊息, 可以不必理會它, 無妨,此時,您會在 /home/httpd/htdocs/mrtg 中,發現 mrtg 已幫您產生了許多流量分析的顯示圖表) > ./indexmaker mrtg.cfg >/home/httpd/htdocs/mrtg/index.htm (產生MRTG流量圖的首頁) 讓mrtg每5分鐘執行一次 >crontab -u root -e > 0,5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/local/mrtg-2/bin/mrtg /usr/local/mrtg-2/bin/mrtg.cfg 運作原理: MRTG其實可算是一個簡單的網管軟體,它是利用SNMP協定,去偵測(查詢)您指定有SNMP協定的網路設備,每五分鐘統計其設備之流量,再將統計結果繪成統計圖;其最大的功能在於我們能很容易地就由統計圖上觀察出實際網路的流量。 使用上的限制: 該軟體適用於Microsoft NT或Unix各種作業統,誠如上節所述,最大的限制在於您的Router或HUB必須支援SNMP,否則是無法查詢得到實際的流量的。 參考資料 Windows版 MRTG 安裝手冊 ADSL MRTG FOR WINDOWS 2000 PRO MRTG網路流量統計
------
**********************************************************
哈哈&兵燹
最會的2大絕招 這個不會與那個也不會 哈哈哈 粉好

Delphi K.Top的K.Top分兩個字解釋Top代表尖端的意思,希望本討論區能提供Delphi的尖端新知
K.表Knowlege 知識,就是本站的標語:Open our mind
andersonhsieh
版主


發表:33
回覆:531
積分:439
註冊:2002-06-10

發送簡訊給我
#2 引用回覆 回覆 發表時間:2002-07-19 13:58:50 IP:211.20.xxx.xxx 未訂閱
那一個檔才是window用的 @@~~飛翔在天際的精靈~~@@
------
@@~~飛翔在天際的精靈~~@@
jackkcg
站務副站長


發表:891
回覆:1050
積分:848
註冊:2002-03-23

發送簡訊給我
#3 引用回覆 回覆 發表時間:2002-07-20 00:20:54 IP:61.70.xxx.xxx 未訂閱
去下載 1  http://www.cruzio.com/~jeffl/mrtg/docs/w95mrtg.htm 2  http://www.activestate.com/Products/Download/Get.plex?id=ActivePerl&_x=1 中文安裝說明 http://www.freecoolpages.com/roadhouse/awho/mrtg/win2k/mrtgwin2k.html    MRTG for Windows 95, 98, and ME by Jeff Liebermann. Ver 3.06   for MRTG version 2.9.21    --------------------------------------------------------------------------------    Introduction MRTG (Multi-Router Traffic Grapher) is used to generate traffic graphs for network connections on a Windows 95/98 workstation. No external router is required for testing. The following are the basic instructions needed to download, install, configure, and test, MRTG on a Windows 95/98/ME client machine using localhost for testing.  These instructions will NOT work with NT4 or W2K.  Please perform the following steps in roughly the order shown. Be sure to test each part before blundering onward. Some knowledge of MSDOS command line operations is assumed. You will need a long file name compatible UNZIP program and a text editor. PKUNZIP 2.04 will not work.      --------------------------------------------------------------------------------    Download and Install PERL Download Active Perl 5.6.x. for Windoze MSI (8MB).  When you run the install, it will unarchive itself to C:\PERL.  You will need to update your Microsoft Installer to 2.0.  The Active Perl install will complain if it needs the new installer.   Test with:             ECHO PRINT "Hello World" | PERL It should display Hello World and not hang on exit.  If you get some kind of  "Cannot find Perl" error message, fix your PATH= line your AUTOEXEC.BAT file.   --------------------------------------------------------------------------------    Fix a Perl Bug ActiveState Perl 5.6 has a bug in the FindBin.pm module which mangles the directory delimiters and causes RealBin::Bin to incorrectly return:  c:/mrtg-2.9.21/bin\rateup.exe This results in an "Invalid command or filename" error message later when MRTG is run.  Almost all the email I have received involve this error message.  The fix is to add 4 lines near the bottom of:     c:\perl\lib\findbin.pm $RealBin = abs_path($RealBin) if($RealBin);   ## existing line     if ($IsWin32)     {        $Bin =~ s/\//\\/g;     }  Of course, make a backup of findbin.pm before tweaking.  That's a "tilde" after the equal sign in the $Bin line.     If you are unable to use a text editor, you can download a fixed copy of FindBin.pm from here.     A new feature of Active State Perl 5.6.1 build 633 is that it no longer belches "Invalid command or filename".  It now hangs the perl program, locks up the MSDOS window, prevents one from removing the mrtg.cfg_l lock file, and requires a Windoze reboot to recover.         --------------------------------------------------------------------------------    Download and Install MRTG Download MRTG-2.9.21  If MRTG had been updated, check for updates here.  Copy MRTG-2.9.21.ZIP to C:\ (root directory) of your hard disk. When this is unzipped, it will create a directory called C:\MRTG-2.9.21. This is where most everything will be installed. Do not rename this directory. If the MRTG version changes, change the version references in this document.  Run:          C:          CD \          UNZIP -d MRTG-2.9.21.ZIP  Verify that C:\MRTG-2.9.21 directory was properly created and includes various sub directories.     You may want to erase the ZIP file with:             DEL MRTG-2.9.21.ZIP The MRTG program is now installed.   --------------------------------------------------------------------------------    Install SNMP Client Network Services. Install SNMP services and agent.  This will allow you to monitor and graph your own machine.               Start > Settings > ControlPanel > Network > Add > Service > Microsoft > SNMP  If SNMP client services does NOT appear on the list of Microsoft services to Add, download the file W95SNMPZP.EXE from: here.  Copy this file into an empty directory.  Run: W95SNMPZP.EXE to extract the files.               Start > Settings > ControlPanel > Network > Add > Service > HaveDisk > Browse  Point to the SNMP.INF file in the directory with the SNMP stuff. Click OK. Windows will ask to reboot. Say yes.   --------------------------------------------------------------------------------    Testing SNMP on localhost Cut out the following code or download it from here and save it as UPTIME.PL in the  C:\MRTG-2.9.21\LIB\MRTG2 directory.  ------------------- cut here ----------------------------------use BER;use SNMP_Session;# Return the uptime of the localhost to test SNMP$host = "localhost";$community = "public";$oid = encode_oid(1,3,6,1,2,1,1,3,0);    # Uptime$session = SNMP_Session->open ($host, $community, 161)    || die "Can't open SNMP session to localhost";$session->get_request_response ($oid);($bindings) = $session->decode_get_response ($session->{pdu_buffer});($binding,$bindings) = &decode_sequence ($bindings);($oid,$value) = &decode_by_template ($binding, "%O%@");print &pretty_print($oid)," => ", &pretty_print ($value), "\n";------------------- cut here ----------------------------------- Run it with:          CD \MRTG-2.9.21\LIB\MRTG2          PERL UPTIME.PL     It should display the uptime of your machine.  If it does NOT work, you may not have SNMP properly installed on your Windows machine.         --------------------------------------------------------------------------------    Check the C:\WINDOWS\HOSTS File. Create or edit the file C:\WINDOWS\HOSTS that should contain the line:          127.0.0.1  localhost near the top. This file may already exist and may have other entries. The localhost line must be present.  Open an MSDOS window and run:             PING LOCALHOST It should return something like:    Pinging karma.learnbydestroying.com [127.0.0.1] with 32 bytes of data:  Reply from 127.0.0.1: bytes=32 time=1ms TTL=128  Reply from 127.0.0.1: bytes=32 time=1ms TTL=128  Reply from 127.0.0.1: bytes=32 time=1ms TTL=128  Reply from 127.0.0.1: bytes=32 time=1ms TTL=128 Localhost must work in order to monitor your own traffic.   --------------------------------------------------------------------------------    Create a Simple MRTG.CFG Configuration Test File. Run:          C:        CD \MRTG-2.9.21\BIN        PERL CFGMAKER public@localhost This should fill the screen with something like:    Target[localhost.2]: 2:public@localhost  MaxBytes[localhost.2]: 10000  Title[localhost.2]: JEFFLIEB (mg130-151.ricochet.net): PPP Adapter.  PageTop[localhost.2]: [h1]Traffic Analysis for PPP Adapter.   [h1]   
System:JEFFLIEB in Santa Cruz
Maintainer:Jeff Liebermann
Interface:PPP Adapter. (2)
IP:mg130-151.ricochet.net (204.179.130.151)
Max Speed: 10000.0 Bytes/s (ethernetCsmacd)
To generate this output requires that PERL SNMP and W95/98/ME networking are working. Troubleshoot according to the error messages generated. Note that the output will change depending upon which network interface (PPP, ethernet) is active and which ISP is active. Try it connecting to the internet via various ISP's and note the differences. When it looks reasonable, run: PERL CFGMAKER public@localhost > MRTG.CFG You may find a problem with the MaxBytes: line. For some unknown reason, my systems decided that the MaxBytes: of my radio modem was 1200 Bytes/sec. I edited the above MRTG.CFG file and increased the speed to an overly optimistic 10,000 Bytes/sec. -------------------------------------------------------------------------------- Tweaking the MRTG.CFG File. MRTG needs to know where to dump its output. If you are running the IE "Personal Web Server", edit MRTG.CFG and add at the top: WorkDir: C:\InetPub\wwwroot\mrtg Options[_]: growright, unknaszero WithPeak[_]: wmy Note the space after the comma in the Options[_] line. This is required. Make sure that the WorkDir directory exists. There should be no spaces between the left margin and the various entries. If you are not running a local web server, keep it simple and instead use just: WorkDir: C:\MRTGDATA Options[_]: growright, unknaszero WithPeak[_]: wmy Create a corresponding empty C:\MRTGDATA directory. You will need to copy the graphics to the WorkDir. Run: COPY C:\MRTG-2.9.21\IMAGES\*.* C:\MRTGDATA It should say 8 files copied. -------------------------------------------------------------------------------- Run it First Manually. Run: C: CD \MRTG-2.9.21\BIN PERL MRTG MRTG.CFG In earlier versions, you may get some errors about "Can't remove ..." This is normal. You should not get these errors in MRTG 2.9.17 and above. Run the above command line twice again until the errors disappear. Check the WorkDir for the output files. If you get one or more "Bad command or filename" errors, or Perl just hangs requiring a reboot to recover, go to the section labeled "Fix a Perl Bug" and follow the instructions. -------------------------------------------------------------------------------- View the Results. Start your Netscape, Opera or IE browser. Open File: C:\MRTGDATA\localhost_12345678.html You should see a familiar MRTG page with 3ea graphs. There will probably be no data to graph at this time. This is normal. -------------------------------------------------------------------------------- Starting MRTG To daemonize (run in the background) MRTG, edit the mrtg.cfg file and add near the top of the file: RunAsDaemon: Yes Interval: 5 Open an MSDOS window. From the command line, run: CD \MRTG-2.9.21\BIN PERL MRTG MRTG.CFG You should get the message: Daemonizing MRTG... Do Not close this window. Or MRTG will die In past versions, MRTG would display an obnoxious windows box every time MRTG runs. This was fixed in MRTG version 2.9.17 (hurrah). For those wishing instructions on how to run MRTG without using the RunAsDaemon: Yes feature, see: http://www.cruzio.com/~jeffl/mrtg/docs/w95batch.htm To stop MRTG, open the window labeled PERL, and hit C or
. If you make changes to mrtg.cfg, you should stop MRTG and restart. -------------------------------------------------------------------------------- Tweaking SNMP Microsoft did not bother to supply a way to set the sysContact, sysLocation and Community name. The usual way is to use REGEDIT which is rather overkill. It's much easier from the command line. Backup your existing registry with: CD \WINDOWS ATTRIB -r -h -s SYSTEM.DAT COPY SYSTEM.DAT SYSTEM.OLD For Windows 98 and Windows ME, cut and save the following as SNMP.REG in the C:\MRTG-2.9.21\BIN directory. ------------------------ cut here ------------------------- REGEDIT4[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\SNMP][HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\SNMP\Parameters][HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\SNMP\Parameters\EnableAuthenticationTraps]"switch"=hex:01,00,00,00[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\SNMP\Parameters\ExtensionAgents]"1"="SOFTWARE\\Microsoft\\RFC1156Agent\\CurrentVersion"[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\SNMP\Parameters\PermittedManagers][HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\SNMP\Parameters\TrapConfiguration][HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\SNMP\Parameters\RFC1156Agent]"sysContact"="Your Name Here""sysLocation"="Your Location Here""sysServices"=hex:4c,00,00,00[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\SNMP\Parameters\ValidCommunities]"1"="public" ------------------------ cut here ------------------------- For Windows 95, cut and save the following as SNMP.REG in the C:\MRTG-2.9.21\BIN directory. ------------------------ cut here -------------------------REGEDIT4[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\SNMP\Parameters\RFC1156Agent]"sysContact"="Your Name Here""sysLocation"="Your Location Here""sysServices"=hex:4c,00,00,00[HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\SNMP\Parameters\ValidCommunities]"1"="public"------------------------ cut here ------------------------- Edit the file as required. I suggest you leave the sysServices and Communities alone. Run: REGEDIT SNMP.REG from the command line. It should say that the registry was properly updated. If you have an existing entry for localhost in your MRTG.CFG file, you will need to recreate it as the names in the header do not change automatically. If SNMP appears to malfunctioning, try the reg files at: http://www.wtcs.org/snmp4tpc/snmp49x.htm which are more detailed. -------------------------------------------------------------------------------- Notes and Problems. Wrong MaxBytes value from cfgmaker. If your graph shows nothing, then MRTG is discarding returned values as being over the MaxBytes limit. Please edit MRTG.CFG to fix. If MRTG or PING causes the modem to dial out looking for a DNS nameserver, disarm the monster by turning off "Dial on Demand" or by selecting "Connect to internet via local network". If you get a Bad Command or Filename error messages, see the section on Fix a Perl Bug. If MRTG hangs when you run from the command line, you are using Active State 5.6.1 build 633 and have failed to properly Fix a Perl Bug. If you are unable to use a text editor, you can download a fixed copy of FindBin.pm from here. If you get "Cannot find WorkDir" error, remove the spaces in front of the Workdir line in mrtg.cfg. 90% of the email I receive are the result of 2 problems. Failure to properly edit or install FindBin.pm as in Fix a Perl Bug, and failure for SNMP to operate under the original version of Windoze 98 (4.00.1998). The Perl bug can be fixed by following instructions. The Windoze 98 problem is usually repaired by removing SNMP, rebooting, and re-installing SNMP, with the Network control panel tool. -------------------------------------------------------------------------------- References and Heavy Reading. MRTG Home Page. How to Install SNMP on SCO Unix. SNMP Support for Perl 5 The Windoze NT Idiot's Guide to MRTG SNMP for the PC -------------------------------------------------------------------------------- Miscellaneous Drivel and Administrivia. The latest version of this page is here. Email comments, corrections, additions and gratuities to Jeff Liebermann Revision History V2.01 11/09/00 Update to ActivePerl 5.6 (with FindBin bug fix) and MRTG 2.9.4 V2.02 11/10/00 Typo error in FindBin fix. Argh. V2.03 03/02/01 Fixed location of UPTIME.PL, update to 2.9.10, updated .REG files. V3.01 06/10/01 Edited for 2.9.17 and removed references to exploding windows. V3.02 07/20/01 Added notes on leading spaces before Workdir. V3.03 08/23/01 Fixed wrong directory in "run manually". Oops. V3.05 07/09/02 Update to 2.9.21 and Active State Perl 5.6.1 build 633 bugs and hangs. V3.06 07/16/02 Some notes on troubleshooting -------------------------------------------------------------------------------- 發表人 - jackkcg 於 2002/07/20 00:35:07 發表人 - jackkcg 於 2002/07/20 00:36:05
------
**********************************************************
哈哈&兵燹
最會的2大絕招 這個不會與那個也不會 哈哈哈 粉好

Delphi K.Top的K.Top分兩個字解釋Top代表尖端的意思,希望本討論區能提供Delphi的尖端新知
K.表Knowlege 知識,就是本站的標語:Open our mind
系統時間:2024-11-21 18:49:25
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!