1MRTG-NT-GUIDE(1)                     mrtg                     MRTG-NT-GUIDE(1)
2
3
4

NAME

6       mrtg-nt-guide - The Windows Guide to MRTG 2.15.1
7

SYNOPSIS

9       Installing MRTG on a Windows box is not quite as "click and point" as
10       some might want it to be. But then again, it is not all that difficult
11       if you follow the instructions below.
12

PREREQUISITES

14       To get MRTG to work on Windows you need the following:
15
16       ·   A current copy of Perl.  For Example ActivePerl from
17           http://www.activestate.com/Products/Download/Down
18           load.plex?id=ActivePerl
19
20       ·   The latest version of MRTG from http://oss.oetiker.ch/mrtg/pub Look
21           for mrtg-2.15.1.zip or better. The archive also contains a precom‐
22           piled copy of rateup.exe for Win32.
23

INSTALLING

25       I suggest you do the following from the machine that will be running
26       MRTG, which, in this case, is also a web server. All examples are for
27       doing things to a LOCAL machine.
28
29       First
30           Unzip MRTG to C:\mrtg-2.15.1 on the Windows machine of your choice.
31
32       Next
33           Install Perl on the same Windows machine. You might want to make
34           sure that the Perl binary directory is listed in your system path.
35
36            C:\Perl\bin;%SystemRoot%\system32;%SystemRoot%;...
37
38           You can manually check this by going to [Control Panel]->[Sys‐
39           tem]->[Environment]
40
41       To see if everything is installed properly you can open a Command Shell
42       and go into c:\mrtg-2.15.1\bin. Type:
43
44        perl mrtg
45
46       This should give you a friendly error message complaining about the
47       missing MRTG configuration file. Now, you have successfully installed
48       MRTG and Perl.
49

CONFIGURING MRTG

51       Now it is time to create a configuration for MRTG. But before we begin
52       you need to know a few things. Take an opportunity to gather the fol‐
53       lowing information:
54
55       ·   The IP address or hostname and the SNMP port number, (if non stan‐
56           dard), of the device you want to monitor.
57
58       ·   If you want to monitor something other than bytes in and out, you
59           must also know the SNMPOID of what you want to monitor.
60
61       ·   Finally you need to know the read-only SNMP community string for
62           your device. If you don't know it, try public, that is the default.
63
64       For the rest of this document we will be using device 10.10.10.1 ( a
65       CISCO Catalyst 5000) with Community string public. We are interested in
66       monitoring traffic, and the CPU load. Let's begin.
67
68       The first thing we do in setting up MRTG is making a default config
69       file.  Get to a cmd prompt and change to the c:\mrtg-2.15.1\bin direc‐
70       tory. Type the following command:
71
72        perl cfgmaker public@10.10.10.1 --global "WorkDir: c:\www\mrtg" --output mrtg.cfg
73
74       This creates an initial MRTG config file for you. Note that in this
75       file all interfaces of your router will be stored by number. Unfortu‐
76       nately, these numbers are likely to change whenever you reconfigure
77       your router. In order to work around this you can get cfgmaker to pro‐
78       duce a configuration which is based on Ip numbers, or even Interface
79       Descriptions. Check cfgmaker
80
81       If you get an error message complaining about no such name or no
82       response, your community name is probably wrong.
83
84       Now, let's take a look at the mrtg.cfg file that was created.
85
86       In Perl, a "#" is a comment, synonymous with "REM" in DOS.
87
88       Add the following to the top of the mrtg.cfg file:
89
90        WorkDir: D:\InetPub\wwwroot\MRTG
91
92       This is where the web pages are created, usually a web root.
93
94        ######################################################################
95        # Description: LCP SUWGB
96        # Contact: Administrator
97        # System Name: LC-Bridge
98        # Location: Here
99        #.....................................................................
100
101       TargetDevice's IP Address:Interface Number:Community:IP Address
102
103        Target[10.10.10.1.1]: 1:public@10.10.10.1
104
105       This is the interface speed (Default is 10 megabits; for 100Mbit
106       devices use 12500000 and so on...)
107
108        MaxBytes[10.10.10.1.1]: 1250000
109
110        Title[10.10.10.1.1]: LC-Bridge (sample.device): ether0
111
112       This section determines how the web page headers will look
113
114        PageTop[10.10.10.1.1]: <H1>Traffic Analysis for ether0</H1>
115         <TABLE>
116         <TR><TD>System:</TD><TD>LC-Bridge inAndover</TD></TR>
117         <TR><TD>Maintainer:</TD><TD>Administrator</TD></TR>
118         <TR><TD>Interface:</TD><TD>ether0(1)</TD></TR>
119         <TR><TD>IP:</TD><TD>sample.device(10.10.10.1)</TD></TR>
120         <TR><TD>Max Speed:</TD>
121         <TD>1250.0 kBytes/s (ethernetCsmacd)</TD></TR>
122         </TABLE>
123
124         Target[10.10.10.1.2]: 2:public@10.10.10.1
125         MaxBytes[10.10.10.1.2]: 1250000
126         Title[10.10.10.1.2]: LC-Bridge (): ulink0
127         PageTop[10.10.10.1.2]: <H1>Traffic Analysis for ulink0</H1>
128          <TABLE>
129          <TR><TD>System:</TD><TD>LC-Bridge inAndover</TD></TR>
130          <TR><TD>Maintainer:</TD><TD>Administrator</TD></TR>
131          <TR><TD>Interface:</TD><TD>ulink0(2)</TD></TR>
132          <TR><TD>IP:</TD><TD>()</TD></TR>
133          <TR><TD>Max Speed:</TD>
134          <TD>1250.0 kBytes/s (ethernetCsmacd)</TD></TR>
135          </TABLE>
136
137         #---------------------------------------------------------------
138
139       And that's a very basic MRTG config file. You can run this and see your
140       results by going into the c:\mrtg-2.15.1\bin directory and typing:
141
142        perl mrtg mrtg.cfg
143
144       It is normal to get errors for the first two times you run this com‐
145       mand. The errors will alert you about the fact that there have not been
146       any log files in existence before.
147
148       If you take a look at those web pages they are not very exciting (yet).
149       You need to have the MRTG files run every five minutes to produce the
150       desired results.  Just run it again after a few minutes. You should now
151       be able to see the first lines in your graphs.
152

MAKE MRTG RUN ALL THE TIME

154       Starting MRTG by hand every time you want to run it is not going to
155       make you happy I guess.
156
157       There is a special option you can set in the MRTG configuration file so
158       so that MRTG will not terminate after it was started. Instead it will
159       wait for 5 minutes and then run again.
160
161       Add the option
162
163        RunAsDaemon: yes
164
165       to your mrtg.cfg file and start it with:
166
167        start /Dc:\mrtg-2.15.1\bin wperl mrtg --logging=eventlog mrtg.cfg
168
169       If you use wperl instead of perl, no console window will show. MRTG is
170       now running in the background. If it runs into problems it will tell
171       you so over the EventLog. To stop MRTG, open the Task Manager and ter‐
172       minate the wperl.exe process. If mrtg has anything to tell you these
173       messages can be found in the event log.
174
175       If you put a shortcut with
176
177        Target:    wperl mrtg --logging=eventlog mrtg.cfg
178        Start in:  c:\mrtg-2.15.1\bin
179
180       into your start-up folder, MRTG will now start whenever you login to
181       your NT box.
182
183       If you do not want to log into your box just to start MRTG. Have a look
184       at http://www.firedaemon.com/mrtg-howto.html which describes a free
185       tool to start any program as a Service. The pages gives specific
186       instructions for MRTG users.
187

HOW TO SETUP MRTG AS A WINDOWS SERVICE

189       Additional Prerequisites
190
191       ·   MRTG must be installed and fully configured on the target system.
192           In the following exercise the assumption is that MRTG is installed
193           under c:\mrtg\ and all the sample files use this location.
194
195       ·   Microsoft Tools SRVANY.exe (Applications as Services Utility) and
196           INSTSRV.exe (Service Installer) - Those files can be downloaded
197           from Microsoft as a part of Windows 2000 Resource Kit at
198           <http://www.microsoft.com/windows2000/tech
199           info/reskit/tools/default.asp>.  They are also available from other
200           locations such as <http://www.electrasoft.com/srvany/srvany.htm>,
201           <http://www.iopus.com/guides/srvany.htm>, etc.  Detailed instruc‐
202           tions on how to use this package are available at <http://sup
203           port.microsoft.com/kb/q137890/>.  In order to follow the steps in
204           this HOW-TO you MUST obtain both executables.
205
206       ·   You must have administrative rights on the target system.
207
208       Preparation
209
210       Please complete the following steps before starting the installation:
211
212       ·   Copy srvany.exe and instsrv.exe to c:\mrtg\bin\ (your MRTG bin
213           directory).
214
215       ·   Create a file called mrtg.reg anywhere on your system and paste the
216           following content into it:
217
218            Windows Registry Editor Version 5.00
219
220            [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MRTG\Parameters]
221            "Application"="c:\\perl\\bin\\wperl.exe"
222            "AppParameters"="c:\\mrtg\\bin\\mrtg --logging=eventlog c:\\mrtg\\bin\\mrtg.cfg"
223            "AppDirectory"="c:\\mrtg\\bin\\"
224
225       Service Installation
226
227       Once again, assuming that MRTG is already fully installed and config‐
228       ured on the target system under c:\mrtg\ the following steps are neces‐
229       sary to setup MRTG as a service.
230
231       Using the command prompt go into the temporary directory where you
232       unzipped the package.  When there type the following command to create
233       a service named "MRTG" in the Windows Services management console:
234
235        instsrv MRTG c:\mrtg\bin\srvany.exe
236
237       Now you need to create the App* entries required for the new service.
238       You can do this by either right-clicking on the mrtg.reg file and
239       selecting 'merge' or by running the following command:
240
241        regedit /s mrtg.reg
242
243       After setting up the registry entry it is time to point it to your MRTG
244       installation.  If you have installed MRTG under c:\mrtg\, you can skip
245       this step.  Open your registry editor (Start -> Run -> regedt32), and
246       locate the [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MRTG]
247       key.  Make sure that the ImagePath variable is correctly pointing to
248       srvany.exe located in your MRTG bin directory (for example
249       c:\mrtg\bin\srvany.exe).  Next you have to expand the MRTG tree, and go
250       to the [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Ser‐
251       vices\MRTG\Parameters] key.  Under Parameters make sure that all the
252       Application variables are setup properly.
253
254       At this point you are ready to run the service.  The only thing left to
255       do is to start the MRTG service in the Services management console.
256       After you do this, you should see two new processes running on your
257       system: srvany.exe and wperl.exe.  Make sure to stop any previously
258       running MRTG processes to avoid conflict.
259
260       Note that it is imperative to set the RunAsDaemon: yes option or the
261       service will stop after just one single run!
262

EXAMPLE

264       Now lets look at a config file to monitor what we wanted to on our
265       mythical Cisco Cat 5000 -- utilization on ports 3, 5, 10, and 24, and
266       the CPU Load, which will show us nonstandard mrtg configurations as
267       well as more options..
268
269        WorkDir: D:\InetPub\wwwroot\MRTG
270        RunAsDaemon: yes
271
272        ######################################################################
273        # Description: LCP SUWGB
274        # Contact: Administrator
275        # System Name: LC-Bridge
276        # Location: Here
277        #.....................................................................
278
279        Target[10.10.10.1.1]: 3:public@10.10.10.1
280        MaxBytes[10.10.10.1.1]: 1250000
281        Title[10.10.10.1.1]: LC-Bridge (sample-device): ether0
282        PageTop[10.10.10.1.1]: <H1>Traffic Analysis for ether0</H1>
283         <TABLE>
284        <TR><TD>System:</TD><TD>LC-Bridge inAndover</TD></TR>
285        <TR><TD>Maintainer:</TD><TD>Administrator</TD></TR>
286        <TR><TD>Interface:</TD><TD>ether0(3)</TD></TR>
287        <TR><TD>IP:</TD><TD>sample-device(10.10.10.1)</TD></TR>
288        <TR><TD>Max Speed:</TD>
289        <TD>1250.0 kBytes/s (ethernetCsmacd)</TD></TR>
290        </TABLE>
291
292        #---------------------------------------------------------------
293
294        Target[10.10.10.1.2]: 5:public@10.10.10.1
295        MaxBytes[10.10.10.1.2]: 1250000
296        Title[10.10.10.1.2]: LC-Bridge (): ulink0
297        PageTop[10.10.10.1.2]: <H1>Traffic Analysis for ulink0</H1>
298         <TABLE>
299         <TR><TD>System:</TD><TD>LC-Bridge inAndover</TD></TR>
300         <TR><TD>Maintainer:</TD><TD>Administrator</TD></TR>
301         <TR><TD>Interface:</TD><TD>ulink0(5)</TD></TR>
302         <TR><TD>IP:</TD><TD>()</TD></TR>
303         <TR><TD>Max Speed:</TD>
304         <TD>1250.0 kBytes/s (ethernetCsmacd)</TD></TR>
305         </TABLE>
306
307        #---------------------------------------------------------------
308
309        Target[10.10.10.1.1]: 10:public@10.10.10.1
310        MaxBytes[10.10.10.1.1]: 1250000
311        Title[10.10.10.1.1]: LC-Bridge (sample-device): ether0
312        PageTop[10.10.10.1.1]: <H1>Traffic Analysis for ether0</H1>
313         <TABLE>
314         <TR><TD>System:</TD><TD>LC-Bridge inAndover</TD></TR>
315         <TR><TD>Maintainer:</TD><TD>Administrator</TD></TR>
316         <TR><TD>Interface:</TD><TD>ether0(10)</TD></TR>
317         <TR><TD>IP:</TD><TD>sample-device(10.10.10.1)</TD></TR>
318         <TR><TD>Max Speed:</TD>
319         <TD>1250.0 kBytes/s (ethernetCsmacd)</TD></TR>
320         </TABLE>
321
322        #---------------------------------------------------------------
323
324        Target[10.10.10.1.2]: 24:public@10.10.10.1
325        MaxBytes[10.10.10.1.2]: 1250000
326        Title[10.10.10.1.2]: LC-Bridge (): ulink0
327        PageTop[10.10.10.1.2]: <H1>Traffic Analysis for ulink0</H1>
328         <TABLE>
329         <TR><TD>System:</TD><TD>LC-Bridge inAndover</TD></TR>
330         <TR><TD>Maintainer:</TD><TD>Administrator</TD></TR>
331         <TR><TD>Interface:</TD><TD>ulink0(24)</TD></TR>
332         <TR><TD>IP:</TD><TD>()</TD></TR>
333         <TR><TD>Max Speed:</TD>
334         <TD>1250.0 kBytes/s (ethernetCsmacd)</TD></TR>
335         </TABLE>
336
337        #---------------------------------------------------------------
338
339        # Router CPU load %
340        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:public@10.10.10.1
341        RouterUptime[cpu.1]: public@10.10.10.1
342        MaxBytes[cpu.1]: 100
343        Title[cpu.1]: CPU LOAD
344        PageTop[cpu.1]: <H1>CPU Load %</H1>
345        Unscaled[cpu.1]: ymwd
346        ShortLegend[cpu.1]: %
347        XSize[cpu.1]: 380
348        YSize[cpu.1]: 100
349        YLegend[cpu.1]: CPU Utilization
350        Legend1[cpu.1]: CPU Utilization in % (Load)
351        Legend2[cpu.1]: CPU Utilization in % (Load)
352        Legend3[cpu.1]:
353        Legend4[cpu.1]:
354        LegendI[cpu.1]:
355        LegendO[cpu.1]: &nbsp;Usage
356        Options[cpu.1]: gauge
357
358       This is a nice example of how to monitor any SNMP device if you know
359       what OID you want to use. Once again, for an explanation of the more
360       advance features of mrtg, please see the rest of the documentation.
361

AUTHORS

363       Tobi Oetiker <tobi@oetiker.ch>, David S. Divins <ddivins@moon.jic.com>,
364       Steve Pierce <MRTG@HDL.com>, Artyom Adjemov <one.bofh@gmail.com>, Ilja
365       Ivanov <ivanov@bseu.by> Karel Fajkus <http://fajkus.cz/>
366
367
368
3692.15.1                            2007-02-01                  MRTG-NT-GUIDE(1)
Impressum