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

NAME

6       mrtg-nt-guide - The MRTG 2.16.2 Windows Installation Guide
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 5.8.8 from ActiveS‐
17           tate http://www.activestate.com/store/activeperl/download/
18
19       ·   The latest version of MRTG from http://oss.oetiker.ch/mrtg/pub.
20           Look for mrtg-2.16.2.zip or better. The archive also contains a
21           precompiled copy of rateup.exe for Win32.
22

INSTALLING

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

CONFIGURING MRTG

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

MAKE MRTG RUN ALL THE TIME

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

HOW TO SETUP MRTG AS A WINDOWS SERVICE

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

EXAMPLE

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

AUTHORS

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