nt-guide - The Windows NT Guide to MRTG 2.9.17
C:\Perl\bin;%SystemRoot%\system32;%SystemRoot%;...You can manually check this by going to [Control Panel]->[System]->[Environment]
To see if everything is installed properly you can open a Command Shell and go into c:\mrtg-2.9.17\bin. Type:
perl mrtgThis should give you a friendly error message complaining about the missing mrtg configuration file. Now, you have successfully installed mrtg and perl.
For the rest of this document we will be using device 10.10.10.1 ( a CISCO Catalyst 5000) with Community string public.═ We are interested in monitoring traffic, and the CPU Load. Let's begin.
The first thing we do in setting up mrtg is by making a default config file. Get to a cmd prompt and change to the c:\mrtg-2.9.17\bin directory. Type the following command:
perl cfgmaker [email protected] --global "WorkDir: c:\www\mrtg" --output mrtg.cfg
This creates an initial MRTG config file for you. Note that in this file all interfaces
of your router will be stored by number. Unfortunately these numbers are likely to change when ever you
reconfigure your router. So in order to work around this you can get cfgmaker to produce a configuration
which is based on Ip numbers, or even Interface Descriptions. Check the cfgmaker manpage
If you get an error message complaining about no such name or no response, your community name is probably wrong.
Now, lets take a look at the mrtg.cfg file that was created.
In Perl a "#" is a comment, synonymous with "REM" in DOS.
Add the following to the top of the mrtg.cfg file:
WorkDir: D:\InetPub\wwwroot\MRTGThis is where the web pages are created, usually a web root.
###################################################################### # Description: LCP SUWGB # Contact: Administrator # System Name: LC-Bridge # Location: Here #.....................................................................TargetDevice's IP Address:Interface Number:Community:IP Address
Target[10.10.10.1.1]: 1:[email protected]
This is the interface speed (Default is 10 megabits; for 100Mbit devices use 12500000 and so on...)
MaxBytes[10.10.10.1.1]: 1250000
Title[10.10.10.1.1]: LC-Bridge (sample.device): ether0This section determines how the web page headers will look
PageTop[10.10.10.1.1]: <H1>Traffic Analysis for ether0</H1> <TABLE> <TR><TD>System:</TD><TD>LC-Bridge inAndover</TD></TR> <TR><TD>Maintainer:</TD><TD>Administrator</TD></TR> <TR><TD>Interface:</TD><TD>ether0(1)</TD></TR> <TR><TD>IP:</TD><TD>sample.device(10.10.10.1)</TD></TR> <TR><TD>Max Speed:</TD> <TD>1250.0 kBytes/s (ethernetCsmacd)</TD></TR> </TABLE>
Target[10.10.10.1.2]: 2:[email protected]
MaxBytes[10.10.10.1.2]: 1250000
Title[10.10.10.1.2]: LC-Bridge (): ulink0
PageTop[10.10.10.1.2]: <H1>Traffic Analysis for ulink0</H1>
<TABLE>
<TR><TD>System:</TD><TD>LC-Bridge inAndover</TD></TR>
<TR><TD>Maintainer:</TD><TD>Administrator</TD></TR>
<TR><TD>Interface:</TD><TD>ulink0(2)</TD></TR>
<TR><TD>IP:</TD><TD>()</TD></TR>
<TR><TD>Max Speed:</TD>
<TD>1250.0 kBytes/s (ethernetCsmacd)</TD></TR>
</TABLE>
#---------------------------------------------------------------And that is a very basic mrtg config file. You can run this and see your results by going into the c:\mrtg-2.9.17\bin directory and typing:
perl mrtg mrtg.cfgIt is normal to get errors for the first two times you run this command. The errors will alert you about the fact that there have not been any log files in existnace before.
If you take a look at those web pages they are not real exciting, yet. You need to have the mrtg files run every five minutes to produce the desired results. Just run it again after a few minutes. You should now be able to see the first lines in your graphs.
There is a special option you can set in the mrtg configuration file so so that mrtg will not terminate after it was started. Instead it will wait for 5 minutes and then run again.
Add the option
RunAsDaemon: yesto your mrtg.cfg file and start it with:
start /Dc:\mrtg-2.9.17\bin wperl mrtg --logging=eventlog mrtg.cfgIf you use wperl instead of perl, no console window will show. MRTG is now running in the background. If it runns into problems it will tell you so over the EventLog. To stop MRTG, open the taskmanager and terminate the wperl.exe process. If mrtg has anything to tell you these messages can be found in the eventlog.
If you put a shortcut with
Target: wperl mrtg --logging=eventlog mrtg.cfg Start in: c:\mrtg-2.9.17\bininto your startup folder, mrtg will now start whever you login to your NT box.
If you do not want to log into your NT box just to start mrtg. Have a look at http://www.firedaemon.com/mrtg-howto.html which describes a free tool to start any program as a Service. The pages gives specific instructions for mrtg users.
WorkDir: D:\InetPub\wwwroot\MRTG
###################################################################### # Description: LCP SUWGB # Contact: Administrator # System Name: LC-Bridge # Location: Here #.....................................................................
Target[10.10.10.1.1]: 3:[email protected]
MaxBytes[10.10.10.1.1]: 1250000
Title[10.10.10.1.1]: LC-Bridge (sample-device): ether0
PageTop[10.10.10.1.1]: <H1>Traffic Analysis for ether0</H1>
<TABLE>
<TR><TD>System:</TD><TD>LC-Bridge inAndover</TD></TR>
<TR><TD>Maintainer:</TD><TD>Administrator</TD></TR>
<TR><TD>Interface:</TD><TD>ether0(3)</TD></TR>
<TR><TD>IP:</TD><TD>sample-device(10.10.10.1)</TD></TR>
<TR><TD>Max Speed:</TD>
<TD>1250.0 kBytes/s (ethernetCsmacd)</TD></TR>
</TABLE>
#---------------------------------------------------------------
Target[10.10.10.1.2]: 5:[email protected]
MaxBytes[10.10.10.1.2]: 1250000
Title[10.10.10.1.2]: LC-Bridge (): ulink0
PageTop[10.10.10.1.2]: <H1>Traffic Analysis for ulink0</H1>
<TABLE>
<TR><TD>System:</TD><TD>LC-Bridge inAndover</TD></TR>
<TR><TD>Maintainer:</TD><TD>Administrator</TD></TR>
<TR><TD>Interface:</TD><TD>ulink0(5)</TD></TR>
<TR><TD>IP:</TD><TD>()</TD></TR>
<TR><TD>Max Speed:</TD>
<TD>1250.0 kBytes/s (ethernetCsmacd)</TD></TR>
</TABLE>
#---------------------------------------------------------------
Target[10.10.10.1.1]: 10:[email protected]
MaxBytes[10.10.10.1.1]: 1250000
Title[10.10.10.1.1]: LC-Bridge (sample-device): ether0
PageTop[10.10.10.1.1]: <H1>Traffic Analysis for ether0</H1>
<TABLE>
<TR><TD>System:</TD><TD>LC-Bridge inAndover</TD></TR>
<TR><TD>Maintainer:</TD><TD>Administrator</TD></TR>
<TR><TD>Interface:</TD><TD>ether0(10)</TD></TR>
<TR><TD>IP:</TD><TD>sample-device(10.10.10.1)</TD></TR>
<TR><TD>Max Speed:</TD>
<TD>1250.0 kBytes/s (ethernetCsmacd)</TD></TR>
</TABLE>
#---------------------------------------------------------------
Target[10.10.10.1.2]: 24:[email protected]
MaxBytes[10.10.10.1.2]: 1250000
Title[10.10.10.1.2]: LC-Bridge (): ulink0
PageTop[10.10.10.1.2]: <H1>Traffic Analysis for ulink0</H1>
<TABLE>
<TR><TD>System:</TD><TD>LC-Bridge inAndover</TD></TR>
<TR><TD>Maintainer:</TD><TD>Administrator</TD></TR>
<TR><TD>Interface:</TD><TD>ulink0(24)</TD></TR>
<TR><TD>IP:</TD><TD>()</TD></TR>
<TR><TD>Max Speed:</TD>
<TD>1250.0 kBytes/s (ethernetCsmacd)</TD></TR>
</TABLE>
#---------------------------------------------------------------
# Router CPU load % Target[cpu.1]:1.3.6.1.4.1.9.2.1.58.0&1.3.6.1.4.1.9.2.1.58.0:[email protected] RouterUptime[cpu.1]: [email protected] MaxBytes[cpu.1]: 100 Title[cpu.1]: CPU LOAD PageTop[cpu.1]: <H1>CPU Load %</H1> Unscaled[cpu.1]: ymwd ShortLegend[cpu.1]: % XSize[cpu.1]: 380 YSize[cpu.1]: 100 YLegend[cpu.1]: CPU Utilization Legend1[cpu.1]: CPU Utilization in % (Load) Legend2[cpu.1]: CPU Utilization in % (Load) Legend3[cpu.1]: Legend4[cpu.1]: LegendI[cpu.1]: LegendO[cpu.1]: Usage Options[cpu.1]: gaugeThis is a nice example of how to monitor any SNMP device if you know what OID you want to use. Once again, For an explanation of the more advance features of mrtg, please see Tobias's documentation.
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |