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