1MRTG-NT-GUIDE(1) mrtg MRTG-NT-GUIDE(1)
2
3
4
6 mrtg-nt-guide - The MRTG 2.17.10 Windows Installation Guide
7
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
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
17 ActiveState 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.17.10.zip or better. The archive also contains a
21 precompiled copy of rateup.exe for Win32.
22
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.17.10 on the Windows machine of your
30 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
39 Panel]->[System]->[Environment]
40
41 To see if everything is installed properly you can open a Command Shell
42 and go into c:\mrtg-2.17.10\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
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
53 following information:
54
55 • The IP address or hostname and the SNMP port number, (if non
56 standard), 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.17.10\bin
70 directory. 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.
76 Unfortunately, these numbers are likely to change whenever you
77 reconfigure your router. In order to work around this you can get
78 cfgmaker to produce a configuration which is based on Ip numbers, or
79 even Interface 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: c:\www\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.17.10\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
145 command. The errors will alert you about the fact that there have not
146 been 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
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.17.10\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
172 terminate 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.17.10\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
189 Additional Prerequisites
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/techinfo/reskit/tools/default.asp>.
198 They are also available from other locations such as
199 <http://www.electrasoft.com/srvany/srvany.htm>,
200 <http://www.iopus.com/guides/srvany.htm>, etc. Detailed
201 instructions on how to use this package are available at
202 <http://support.microsoft.com/kb/q137890/>. In order to follow the
203 steps in this HOW-TO you MUST obtain both executables.
204
205 • You must have administrative rights on the target system.
206
207 Preparation
208 Please complete the following steps before starting the installation:
209
210 • Copy srvany.exe and instsrv.exe to c:\mrtg-2.17.10\bin\ (your MRTG
211 bin directory).
212
213 • Create a file called mrtg.reg anywhere on your system and paste the
214 following content into it:
215
216 Windows Registry Editor Version 5.00
217
218 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MRTG\Parameters]
219 "Application"="c:\\perl\\bin\\wperl.exe"
220 "AppParameters"="c:\\mrtg-2.17.10\\bin\\mrtg --logging=eventlog c:\\mrtg-2.17.10\\bin\\mrtg.cfg"
221 "AppDirectory"="c:\\mrtg-2.17.10\\bin\\"
222
223 Service Installation
224 Once again, assuming that MRTG is already fully installed and
225 configured on the target system under c:\mrtg\ the following steps are
226 necessary to setup MRTG as a service.
227
228 Using the command prompt go into the temporary directory where you
229 unzipped the package. When there type the following command to create
230 a service named "MRTG" in the Windows Services management console:
231
232 instsrv MRTG c:\mrtg\bin\srvany.exe
233
234 Now you need to create the App* entries required for the new service.
235 You can do this by either right-clicking on the mrtg.reg file and
236 selecting 'merge' or by running the following command:
237
238 regedit /s mrtg.reg
239
240 After setting up the registry entry it is time to point it to your MRTG
241 installation. If you have installed MRTG under c:\mrtg\, you can skip
242 this step. Open your registry editor (Start -> Run -> regedt32), and
243 locate the [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MRTG]
244 key. Make sure that the ImagePath variable is correctly pointing to
245 srvany.exe located in your MRTG bin directory (for example
246 c:\mrtg\bin\srvany.exe). Next you have to expand the MRTG tree, and go
247 to the
248 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MRTG\Parameters]
249 key. Under Parameters make sure that all the Application variables
250 are setup properly.
251
252 At this point you are ready to run the service. The only thing left to
253 do is to start the MRTG service in the Services management console.
254 After you do this, you should see two new processes running on your
255 system: srvany.exe and wperl.exe. Make sure to stop any previously
256 running MRTG processes to avoid conflict.
257
258 Note that it is imperative to set the RunAsDaemon: yes option or the
259 service will stop after just one single run!
260
262 Now lets look at a config file to monitor what we wanted to on our
263 mythical Cisco Cat 5000 -- utilization on ports 3, 5, 10, and 24, and
264 the CPU Load, which will show us nonstandard mrtg configurations as
265 well as more options..
266
267 WorkDir: c:\www\mrtg
268 RunAsDaemon: yes
269
270 ######################################################################
271 # Description: LCP SUWGB
272 # Contact: Administrator
273 # System Name: LC-Bridge
274 # Location: Here
275 #.....................................................................
276
277 Target[10.10.10.1.1]: 3:public@10.10.10.1
278 MaxBytes[10.10.10.1.1]: 1250000
279 Title[10.10.10.1.1]: LC-Bridge (sample-device): ether0
280 PageTop[10.10.10.1.1]: <H1>Traffic Analysis for ether0</H1>
281 <TABLE>
282 <TR><TD>System:</TD><TD>LC-Bridge inAndover</TD></TR>
283 <TR><TD>Maintainer:</TD><TD>Administrator</TD></TR>
284 <TR><TD>Interface:</TD><TD>ether0(3)</TD></TR>
285 <TR><TD>IP:</TD><TD>sample-device(10.10.10.1)</TD></TR>
286 <TR><TD>Max Speed:</TD>
287 <TD>1250.0 kBytes/s (ethernetCsmacd)</TD></TR>
288 </TABLE>
289
290 #---------------------------------------------------------------
291
292 Target[10.10.10.1.2]: 5:public@10.10.10.1
293 MaxBytes[10.10.10.1.2]: 1250000
294 Title[10.10.10.1.2]: LC-Bridge (): ulink0
295 PageTop[10.10.10.1.2]: <H1>Traffic Analysis for ulink0</H1>
296 <TABLE>
297 <TR><TD>System:</TD><TD>LC-Bridge inAndover</TD></TR>
298 <TR><TD>Maintainer:</TD><TD>Administrator</TD></TR>
299 <TR><TD>Interface:</TD><TD>ulink0(5)</TD></TR>
300 <TR><TD>IP:</TD><TD>()</TD></TR>
301 <TR><TD>Max Speed:</TD>
302 <TD>1250.0 kBytes/s (ethernetCsmacd)</TD></TR>
303 </TABLE>
304
305 #---------------------------------------------------------------
306
307 Target[10.10.10.1.1]: 10:public@10.10.10.1
308 MaxBytes[10.10.10.1.1]: 1250000
309 Title[10.10.10.1.1]: LC-Bridge (sample-device): ether0
310 PageTop[10.10.10.1.1]: <H1>Traffic Analysis for ether0</H1>
311 <TABLE>
312 <TR><TD>System:</TD><TD>LC-Bridge inAndover</TD></TR>
313 <TR><TD>Maintainer:</TD><TD>Administrator</TD></TR>
314 <TR><TD>Interface:</TD><TD>ether0(10)</TD></TR>
315 <TR><TD>IP:</TD><TD>sample-device(10.10.10.1)</TD></TR>
316 <TR><TD>Max Speed:</TD>
317 <TD>1250.0 kBytes/s (ethernetCsmacd)</TD></TR>
318 </TABLE>
319
320 #---------------------------------------------------------------
321
322 Target[10.10.10.1.2]: 24:public@10.10.10.1
323 MaxBytes[10.10.10.1.2]: 1250000
324 Title[10.10.10.1.2]: LC-Bridge (): ulink0
325 PageTop[10.10.10.1.2]: <H1>Traffic Analysis for ulink0</H1>
326 <TABLE>
327 <TR><TD>System:</TD><TD>LC-Bridge inAndover</TD></TR>
328 <TR><TD>Maintainer:</TD><TD>Administrator</TD></TR>
329 <TR><TD>Interface:</TD><TD>ulink0(24)</TD></TR>
330 <TR><TD>IP:</TD><TD>()</TD></TR>
331 <TR><TD>Max Speed:</TD>
332 <TD>1250.0 kBytes/s (ethernetCsmacd)</TD></TR>
333 </TABLE>
334
335 #---------------------------------------------------------------
336
337 # Router CPU load %
338 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
339 RouterUptime[cpu.1]: public@10.10.10.1
340 MaxBytes[cpu.1]: 100
341 Title[cpu.1]: CPU LOAD
342 PageTop[cpu.1]: <H1>CPU Load %</H1>
343 Unscaled[cpu.1]: ymwd
344 ShortLegend[cpu.1]: %
345 XSize[cpu.1]: 380
346 YSize[cpu.1]: 100
347 YLegend[cpu.1]: CPU Utilization
348 Legend1[cpu.1]: CPU Utilization in % (Load)
349 Legend2[cpu.1]: CPU Utilization in % (Load)
350 Legend3[cpu.1]:
351 Legend4[cpu.1]:
352 LegendI[cpu.1]:
353 LegendO[cpu.1]: Usage
354 Options[cpu.1]: gauge
355
356 This is a nice example of how to monitor any SNMP device if you know
357 what OID you want to use. Once again, for an explanation of the more
358 advance features of mrtg, please see the rest of the documentation.
359
361 Tobi Oetiker <tobi@oetiker.ch>, David S. Divins <ddivins@moon.jic.com>,
362 Steve Pierce <MRTG@HDL.com>, Artyom Adjemov <one.bofh@gmail.com>, Ilja
363 Ivanov <ivanov@bseu.by> Karel Fajkus <http://fajkus.cz/>
364
365
366
3672.17.10 2022-01-19 MRTG-NT-GUIDE(1)