1MRTG-REFERENCE(1) mrtg MRTG-REFERENCE(1)
2
3
4
6 mrtg-reference - MRTG 2.16.2 configuration reference
7
9 The runtime behaviour of MRTG is governed by a configuration file.
10 Run-of-the-mill configuration files can be generated with cfgmaker.
11 (Check cfgmaker). But for more elaborate configurations some hand-tun‐
12 ing is required.
13
14 This document describes all the configuration options understood by the
15 mrtg software.
16
18 MRTG configuration file syntax follows some simple rules:
19
20 · Keywords must start at the beginning of a line.
21
22 · Lines which follow a keyword line which start with a blank are
23 appended to the keyword line
24
25 · Empty Lines are ignored
26
27 · Lines starting with a # sign are comments.
28
29 · You can add other files into the configuration file using
30
31 Include: file
32
33 Example:
34
35 Include: base-options.inc
36
37 If included files are specified with relative paths, both the cur‐
38 rent working directory and the directory containing the main config
39 file will be searched for the files.
40
42 WorkDir
43
44 WorkDir specifies where the logfiles and the webpages should be cre‐
45 ated.
46
47 Example:
48
49 WorkDir: /usr/tardis/pub/www/stats/mrtg
50
52 HtmlDir
53
54 HtmlDir specifies the directory where the html (or shtml, but we'll get
55 on to those later) lives.
56
57 NOTE: Workdir overrides the settings for htmldir, imagedir and logdir.
58
59 Example:
60
61 Htmldir: /www/mrtg/
62
63 ImageDir
64
65 ImageDir specifies the directory where the images live. They should be
66 under the html directory.
67
68 Example:
69
70 Imagedir: /www/mrtg/images
71
72 LogDir
73
74 LogDir specifies the directory where the logs are stored. This need
75 not be under htmldir directive.
76
77 Example:
78
79 Logdir: /www/mrtg/logs
80
81 Forks (UNIX only)
82
83 With system that supports fork (UNIX for example), mrtg can fork itself
84 into multiple instances while it is acquiring data via snmp.
85
86 For situations with high latency or a great number of devices this will
87 speed things up considerably. It will not make things faster, though,
88 if you query a single switch sitting next door.
89
90 As far as I know NT can not fork so this option is not available on NT.
91
92 Example:
93
94 Forks: 4
95
96 EnableIPv6
97
98 When set to yes, IPv6 support is enabled if the required libraries are
99 present (see the mrtg-ipv6 manpage). When IPv6 is enabled, mrtg can
100 talk to routers using SNMP over IPv6 and targets may be specified by
101 their numeric IPv6 addresses as well as by hostname or IPv4 address.
102
103 If IPv6 is enabled and the target is a hostname, mrtg will try to
104 resolve the hostname to an IPv6 address and, if this fails, to an IPv4
105 address. Note that mrtg will only use IPv4 if you specify an IPv4
106 address or a hostname with no corresponding IPv6 address; it will not
107 fall back to IPv4 if it simply fails to communicate with the target
108 using IPv6. This is by design.
109
110 Note that many routers do not currently support SNMP over IPv6. Use the
111 IPv4Only per target option for these routers.
112
113 IPv6 is disabled by default.
114
115 Example:
116
117 EnableIPv6: Yes
118
119 EnableSnmpV3
120
121 When set to yes, uses the Net::SNMP module instead of the SNMP_SESSION
122 module for generating snmp queries. This allows the use of SNMPv3 if
123 other snmpv3 parameters are set.
124
125 SNMPv3 is disabled by default.
126
127 Example:
128
129 EnableSnmpV3: yes
130
131 Refresh
132
133 How many seconds apart should the browser (Netscape) be instructed to
134 reload the page? If this is not defined, the default is 300 seconds (5
135 minutes).
136
137 Example:
138
139 Refresh: 600
140
141 Interval
142
143 How often do you call mrtg? The default is 5 minutes. If you call it
144 less often, you should specify it here. This does two things:
145
146 · The generated HTML page contains the right information about the
147 calling interval ...
148
149 · A META header in the generated HTML page will instruct caches about
150 the time-to-live of this page .....
151
152 In this example, we tell mrtg that we will be calling it every 10 min‐
153 utes. If you are calling mrtg every 5 minutes, you can leave this line
154 commented out.
155
156 Example:
157
158 Interval: 10
159
160 Note that unless you are using rrdtool you can not set Interval to less
161 than 5 minutes. If you are using rrdtool you can set interval in the
162 format
163
164 Interval: MM[:SS]
165
166 Down to 1 second. Note though, setting the Interval for an rrdtool/mrtg
167 setup will influence the initial creation of the database. If you
168 change the interval later, all existing databases will remain at the
169 resolution they were initially created with. Also note that you must
170 make sure that your mrtg-rrd Web-frontend can deal with this kind of
171 Interval setting.
172
173 MaxAge
174
175 MRTG relies heavily on the real time clock of your computer. If the
176 time is set to a wrong value, especially if it is advanced far into the
177 future, this will cause mrtg to expire lots of supposedly old data from
178 the log files.
179
180 To prevent this, you can add a 'reasonability' check by specifying a
181 maximum age for log files. If a file seems to be older, mrtg will not
182 touch it but complain instead, giving you a chance to investigate the
183 cause.
184
185 Example:
186
187 MaxAge: 7200
188
189 The example above will make mrtg refuse to update log files older than
190 2 hours (7200 seconds).
191
192 WriteExpires
193
194 With this switch mrtg will generate .meta files for CERN and Apache
195 servers which contain Expiration tags for the html and gif files. The
196 *.meta files will be created in the same directory as the other files,
197 so you will have to set "MetaDir ." and "MetaFiles on" in your
198 apache.conf or .htaccess file for this to work
199
200 NOTE: If you are running Apache-1.2 or later, you can use the
201 mod_expire to achieve the same effect ... see the file htaccess.txt
202
203 Example:
204
205 WriteExpires: Yes
206
207 NoMib2
208
209 Normally we ask the SNMP device for 'sysUptime' and 'sysName' proper‐
210 ties. Some do not have these. If you want to avoid getting complaints
211 from mrtg about these missing properties, specify the nomib2 option.
212
213 An example of agents which do not implement base mib2 attributes are
214 Computer Associates - Unicenter TNG Agents. CA relies on using the
215 base OS SNMP agent in addition to its own agents to supplement the man‐
216 agement of a system.
217
218 Example:
219
220 NoMib2: Yes
221
222 SingleRequest
223
224 Some SNMP implementations can not deal with requests asking for multi‐
225 ple snmp variables in one go. Set this in your cfg file to force mrtg
226 to only ask for one variable per request.
227
228 Examples
229
230 SingleRequest: Yes
231
232 SnmpOptions
233
234 Apart from the per target timeout options, you can also configure the
235 behaviour of the snmpget process on a more profound level. SnmpOptions
236 accepts a hash of options. The following options are currently sup‐
237 ported:
238
239 timeout => $default_timeout,
240 retries => $default_retries,
241 backoff => $default_backoff,
242 default_max_repetitions => $max_repetitions,
243 use_16bit_request_ids => 1,
244 lenient_source_port_matching => 0,
245 lenient_source_address_matching => 1
246
247 The values behind the options indicate the current default value. Note
248 that these settings OVERRIDE the per target timeout settings.
249
250 A per-target SnmpOptions[] keyword will override the global settings.
251 That keyword is primarily for SNMPv3.
252
253 The 16bit request ids are the only way to query the broken SNMP imple‐
254 mentation of SMC Barricade routers.
255
256 Example:
257
258 SnmpOptions: retries => 2, only_ip_address_matching => 0
259
260 Note that AS/400 snmp seems to be broken in a way which prevents mrtg
261 from working with it unless
262
263 SnmpOptions: lenient_source_port_matching => 1
264
265 is set.
266
267 IconDir
268
269 If you want to keep the mrtg icons in someplace other than the working
270 (or imagedir) directory, use the IconDir variable for defining the url
271 of the icons directory.
272
273 Example:
274
275 IconDir: /mrtgicons/
276
277 LoadMIBs
278
279 Load the MIB file(s) specified and make its OIDs available as symbolic
280 names. For better efficiancy, a cache of MIBs is maintained in the
281 WorkDir.
282
283 Example:
284
285 LoadMIBs: /dept/net/mibs/netapp.mib,/usr/local/lib/ft100m.mib
286
287 Language
288
289 Switch output format to the selected Language (Check the translate
290 directory to see which languages are supported at the moment. In this
291 directory you can also find instructions on how to create new transla‐
292 tions).
293
294 Currently the following laguages are supported:
295
296 big5 brazilian bulgarian catalan chinese croatian czech danish dutch
297 eucjp french galician gb gb2312 german greek hungarian icelandic
298 indonesia iso2022jp italian korean lithuanian malay norwegian polish
299 portuguese romanian russian russian1251 serbian slovak slovenian span‐
300 ish swedish turkish ukrainian
301
302 Example:
303
304 Language: danish
305
306 LogFormat
307
308 Setting LogFormat to 'rrdtool' in your mrtg.cfg file enables rrdtool
309 mode. In rrdtool mode, mrtg relies on rrdtool to do its logging. See
310 mrtg-rrd.
311
312 Example:
313
314 LogFormat: rrdtool
315
316 LibAdd
317
318 If you are using rrdtool mode and your rrdtool Perl module (RRDs.pm) is
319 not installed in a location where perl can find it on its own, you can
320 use LibAdd to supply an appropriate path.
321
322 Example:
323
324 LibAdd: /usr/local/rrdtool/lib/perl/
325
326 PathAdd
327
328 If the rrdtool executable can not be found in the normal "PATH", you
329 can use this keyword to add a suitable directory to your path.
330
331 Example:
332
333 PathAdd: /usr/local/rrdtool/bin/
334
335 RunAsDaemon
336
337 The RunAsDaemon keyword enables daemon mode operation. The purpose of
338 daemon mode is that MRTG is launched once and not repeatedly (as it is
339 with cron). This behavior saves computing resourses as loading and
340 parsing of configuration files happens only once.
341
342 Using daemon mode MRTG itself is responible for timing the measurement
343 intervals. Therfore its important to set the Interval keyword to an
344 apropiate value.
345
346 Note that when using daemon mode MRTG should no longer be started from
347 cron as each new process runs forever. Instead MRTG should be started
348 from the command prompt or by a system startup script.
349
350 If you want mrtg to run under a particular user and group (it is not
351 recomended to run MRTG as root) then you can use the --user=user_name
352 and --group=group_name options on the mrtg commandline.
353
354 mrtg --user=mrtg_user --group=mrtg_group mrtg.cfg
355
356 Also note that in daemon mode restarting the process is required in
357 order to activate changes in the config file.
358
359 Under UNIX, the Daemon switch causes mrtg to fork into background after
360 checking its config file. On Windows NT the MRTG process will detach
361 from the console, but because the NT/2000 shell waits for its children
362 you have to use this special start sequence when you launch the pro‐
363 gram:
364
365 start /b perl mrtg mrtg.cfg
366
367 You may have to add path information equal to what you add when you run
368 mrtg from the commandline.
369
370 Example
371
372 RunAsDaemon: Yes
373 Interval: 5
374
375 This makes MRTG run as a daemon beginning data collection every 5 min‐
376 utes
377
378 If you are daemontools and still want to run mrtg as a daemon you can
379 additionally specify
380
381 NoDetach: Yes
382
383 this will make mrtg run but without detaching it from the terminal.
384
385 ConversionCode
386
387 Some devices may produce non-numeric values that would nevertheless be
388 useful to graph with MRTG if those values could be converted to num‐
389 bers. The ConversionCode keyword specifies the path to a file contain‐
390 ing Perl code to perform such conversions. The code in this file must
391 consist of one or more Perl subroutines. Each subroutine must accept a
392 single string argument and return a single numeric value. When RRDtool
393 is in use, a decimal value may be returned. When the name of one of
394 these subroutines is specified in a target definition (see below), MRTG
395 calls it twice for that target, once to convert the the input value
396 being monitored and a second time to convert the output value. The sub‐
397 routine must return an undefined value if the conversion fails. In case
398 of failure, a warning may be posted to the MRTG log file using Perl's
399 warn function. MRTG imports the subroutines into a separate name space
400 (package MRTGConversion), so the user need not worry about pollution of
401 MRTG's global name space. MRTG automatically prepends this package dec‐
402 laration to the user-supplied code.
403
404 Example: Suppose a particular OID returns a character string whose
405 length is proportional to the value to be monitored. To convert this
406 string to a number that can be graphed by MRTG, create a file arbitrar‐
407 ily named "MyConversions.pl" containing the following code:
408
409 # Return the length of the string argument
410 sub Length2Int {
411 my $value = shift;
412 return length( $value );
413 }
414
415 Then include the following global keyword in the MRTG configuration
416 file (assuming that the conversion code file is saved in the mrtg/bin
417 directory along with mrtg itself):
418
419 ConversionCode: MyConversions.pl
420
421 This will cause MRTG to include the definition of the subroutine
422 Length2Int in its execution environment. Length2Int can then be invoked
423 on any target by appending "|Length2Int" to the target definition as
424 follows:
425
426 Target[myrouter]: 1.3.6.1.4.1.999.1&1.3.6.1.4.1.999.1:public@mydevice|Length2Int
427
428 See "Extended Host Name Syntax" below for complete target definition
429 syntax information.
430
432 Each monitoring target must be identified by a unique name. This name
433 must be appended to each parameter belonging to the same target. The
434 name will also be used for naming the generated webpages, logfiles and
435 images for this target.
436
437 Target
438
439 With the Target keyword you tell mrtg what it should monitor. The Tar‐
440 get keyword takes arguments in a wide range of formats:
441
442 Basic
443 The most basic format is "port:community@router" This will generate
444 a traffic graph for the interface 'port' of the host 'router' (dns
445 name or IP address) and it will use the community 'community' (snmp
446 password) for the snmp query.
447
448 Example:
449
450 Target[myrouter]: 2:public@wellfleet-fddi.domain
451
452 If your community contains a "@" or a " " these characters must be
453 escaped with a "\".
454
455 Target[bla]: 2:stu\ pi\@d@router
456
457 SNMPv2c
458 If you have a fast router you might want to try to poll the ifHC*
459 counters. This feature gets activated by switching to SNMPv2c.
460 Unfortunately not all devices support SNMPv2c yet. If it works,
461 this will prevent your counters from wraping within the 5 minute
462 polling interval, since we now use 64 bit instead of the normal 32
463 bit.
464
465 Example:
466
467 Target[myrouter]: 2:public@router1:::::2
468
469 SNMPv3
470 As an alternative to SNMPv2c, SNMPv3 provides access to the ifHC*
471 counters, along with encryption. Not all devices support SNMPv3,
472 and you will also need the perl Net::SNMP library in order to use
473 it. It is recommended that cfgmaker be used to generate configura‐
474 tions involving SNMPv3, as it will check if the Net::SNMP library
475 is loadable, and will switch to SNMPv2c if v3 is unavailable.
476
477 SNMP v3 requires additional authentication parameters, passed using
478 the SnmpOptions[] per-target keyword.
479
480 Example:
481 Target[myrouter]: 2:router1:::::3
482 SnmpOptions[myrouter]: username=>'user1'
483
484 noHC
485 Not all routers that support SNMPv2 or SNMPv3 provide the ifHC*
486 counters on every interface. The noHC[] per-target keyword signals
487 that the low-speed counters ifInOctets and ifOutOctets should be
488 queried instead. cfgmaker will automatically insert this tag if
489 SNMPv2 or SNMPv3 is specified but the ifHC* counters are unavail‐
490 able.
491
492 Example:
493 Target[myrouter]: #Bri0:router1:::::3
494 SnmpOptions[myrouter]: username=>'user1'
495 noHC[myrouter]: yes
496
497 Reversing
498 Sometimes you are sitting on the wrong side of the link, and you
499 would like to have mrtg report Incoming traffic as Outgoing and
500 vice versa. This can be achieved by adding the '-' sign in front of
501 the "Target" description. It flips the incoming and outgoing traf‐
502 fic rates.
503
504 Example:
505
506 Target[ezci]: -1:public@ezci-ether.domain
507
508 Explicit OIDs
509 You can also explicitly define which OID to query by using the fol‐
510 lowing syntax 'OID_1&OID_2:community@router' The following example
511 will retrieve error counts for input and output on interface 1.
512 MRTG needs to graph two variables, so you need to specify two OID's
513 such as temperature and humidity or error input and error output.
514
515 Example:
516
517 Target[myrouter]: 1.3.6.1.2.1.2.2.1.14.1&1.3.6.1.2.1.2.2.1.20.1:public@myrouter
518
519 MIB Variables
520 MRTG knows a number of symbolic SNMP variable names. See the file
521 mibhelp.txt for a list of known names. One example are the ifIn‐
522 Errors and ifOutErrors. This means you can specify the above as:
523
524 Example:
525
526 Target[myrouter]: ifInErrors.1&ifOutErrors.1:public@myrouter
527
528 SnmpWalk
529 It may be that you want to monitor an snmp object that is only
530 reachable by 'walking'. You can get mrtg to walk by prepending the
531 OID with the string WaLK or if you want a particular entry from the
532 table returned by the walk you can use WaLKx where x is a number
533 starting from 0 (!).
534
535 Example:
536
537 Target[myrouter]: WaLKstrangeOid.1&WaLKstrangeOid.2:public@myrouter
538
539 Target[myrouter]: WaLK3strangeOid.1&WaLK4strangeOid.2:public@myrouter
540
541 SnmpGetNext
542 A special case of an snmp object that is only reachable by 'walk‐
543 ing' occurs when a single snmpgetnext will return the correct
544 value, but snmpwalk fails. This may occur with snmp V2 or V3, as
545 the snmpgetbulk method is used in these versions. You can get mrtg
546 to use getnext instead of getbulk by prepending the OID with the
547 string GeTNEXT.
548
549 Example:
550
551 Target[myrouter]: GeTNEXTstrangeOid&GeTNEXTstrangeOid:public@myrouter
552
553 Counted SNMP Walk
554 In other situations, an snmpwalk is needed to count rows, but the
555 actual data is uninteresting. For example, counting the number of
556 mac-addresses in a CAM table, or the number of simultaneous dialup
557 sessions. You can get MRTG to count the number of instances by
558 prepending the OID with the string CnTWaLK. The following will
559 retrieve the number of simultaneous VOIP calls on some routers:
560
561 Example:
562
563 Target[myrouter]: CnTWaLK1.3.6.1.4.1.9.10.55.1.1.1.1.3&CnTWaLK1.3.6.1.4.1.9.10.55.1.1.1.1.3:public@myrouter
564
565 Interface by IP
566 Sometimes SNMP interface index can change, like when new interfaces
567 are added or removed. This can cause all Target entries in your
568 config file to become offset, causing MRTG to graphs wrong
569 instances etc. MRTG supports IP address instead of ifindex in tar‐
570 get definition. Then MRTG will query snmp device and try to map IP
571 address to the current ifindex. You can use IP addresses in every
572 type of target definition by adding IP address of the numbered
573 interface after OID and separation char '/'.
574
575 Make sure that the given IP address is used on your same target
576 router, especially when graphing two different OIDs and/or inter‐
577 face split by '&' delimiter.
578
579 You can tell cfgmaker to generate such references with the option
580 --ifref=ip.
581
582 Example:
583
584 Target[myrouter]: /1.2.3.4:public@wellfleet-fddi.domain
585 Target[ezci]: -/1.2.3.4:public@ezci-ether.domain
586 Target[myrouter]: ifInErrors/1.2.3.4&ifOutErrors/1.2.3.4:public@myrouter
587
588 Interface by Description
589 If you can not use IP addresses you might want to use the interface
590 names. This works similar to the IP address aproach except that the
591 prefix to use is a \ instead of a /
592
593 You can tell cfgmaker to generate such references with the option
594 --ifref=descr.
595
596 Example:
597
598 Target[myrouter]: \My-Interface2:public@wellfleet-fddi.domain
599 Target[ezci]: -\My-Interface2:public@ezci-ether.domain
600 Target[myrouter]: ifInErrors\My-If2&ifOutErrors\My-If3:public@myrouter
601
602 If your description contains a "&", a ":", a "@" or a " " you can
603 include them but you must escape with a backlash:
604
605 Target[myrouter]: \fun\:\ ney\&ddd:public@hello.router
606
607 Interface by Name
608 This is the only sensible way to reference the interfaces of your
609 switches.
610
611 You can tell cfgmaker to generate such references with the option
612 --ifref=name.
613
614 Example:
615
616 Target[myrouter]: #2/11:public@wellfleet-fddi.domain
617 Target[ezci]: -#2/11:public@ezci-ether.domain
618 Target[myrouter]: ifInErrors#3/7&ifOutErrors#3/7:public@myrouter
619
620 If your description contains a "&", a ":", a "@" or a " " you can
621 include them but you must escape with a backlash:
622
623 Target[myrouter]: #\:\ fun:public@hello.router
624
625 Note that the # sign will be interpreted as a comment character if
626 it is the first non white-space character on the line.
627
628 Interface by Ethernet Address
629 When the SNMP interface index changes, you can key that interface
630 by its 'Physical Address', sometimes called a 'hard address', which
631 is the SNMP variable 'ifPhysAddress'. Internally, MRTG matches the
632 Physical Address from the *.cfg file to its current index, and then
633 uses that index for the rest of the session.
634
635 You can use the Physical Address in every type of target definition
636 by adding the Physical Address after the OID and the separation
637 char '!' (analogous to the IP address option). The Physical
638 address is specified as '-' delimited octets, such as
639 "0a-0-f1-5-23-18" (omit the double quotes). Note that some routers
640 use the same Hardware Ethernet Address for all of their Interfaces
641 which prevents unique interface identification. Mrtg will notice
642 such problems and alert you.
643
644 You can tell cfgmaker to generate configuration files with hardware
645 ethernet address references by using the option --ifref=eth.
646
647 Example:
648
649 Target[myrouter]: !0a-0b-0c-0d:public@wellfleet-fddi.domain
650 Target[ezci]: -!0-f-bb-05-71-22:public@ezci-ether.domain
651 Target[myrouter]: 1.3.6.1.2.1.2.2.1.14!0a-00-10-23-44-51& *BREAK*
652 1.3.6.1.2.1.2.2.1.14!0a-00-10-23-44-51:public@myrouter
653 Target[myrouter]: ifInErrors!0a-00-10-23-44-51& *BREAK*
654 ifOutErrors!0a-00-10-23-44-51:public@myrouter
655
656 Join the lines at *BREAK* ...
657
658 Interface by Type
659 It seems that there are devices that try to defy all monitoring
660 efforts: the interesting interfaces have neither ifName nor a con‐
661 stant ifDescr not to mention a persistant ifIndex. The only way to
662 get a constant mapping is by looking at the interface type, because
663 the interface you are interested in is unique in the device you are
664 looking at ...
665
666 You can tell cfgmaker to generate such references with the option
667 --ifref=type.
668
669 Example:
670
671 Target[myrouter]: %13:public@wellfleet-fddi.domain
672 Target[ezci]: -%13:public@ezci-ether.domain
673 Target[myrouter]: ifInErrors%13&ifOutErrors%14:public@myrouter
674
675 Extended positioning of ifIndex
676 There are OIDs that contain the interface index at some inner posi‐
677 tion within the OID. To use the above mentioned Interface by
678 IP/Description/Name/Type methods in the target definition the key‐
679 word 'IndexPOS' can be used to indicate the position of ifIndex. If
680 'IndexPOS' is not used the ifIndex will be appended at the end of
681 the OID.
682
683 Example:
684
685 Target[myrouter]: OID.IndexPOS.1/1.2.3.4&OID.IndexPOS.1/1.2.3.4:public@myrouter
686
687 Replace OID by your numeric OID.
688
689 Extended Host Name Syntax
690 In all places where ``community@router'' is accepted, you can add
691 additional parameters for the SNMP communication using colon-sepa‐
692 rated suffixes. You can also append a pipe symbol ( | ) and the
693 name of a numeric conversion subroutine as described under the
694 global keyword "ConversionCode" above. The full syntax is as fol‐
695 lows:
696
697 community@router[:[port][:[timeout][:[retries][:[backoff][:[version]][|name]]]]]
698
699 where the meaning of each parameter is as follows:
700
701 port
702 the UDP port under which to contact the SNMP agent (default:
703 161)
704
705 The complete syntax of the port parameter is
706
707 remote_port[!local_address[!local_port]]
708
709 Some machines have additional security features that only allow
710 SNMP queries to come from certain IP addresses. If the host
711 doing the query has multiple interface, it may be necessary to
712 specify the interface the query should come from.
713
714 The port parameter allows the specification of the port of the
715 machine being queried. In addition, the IP address (or host‐
716 name) and port of the machine doing the query may be specified.
717
718 Examples:
719
720 somehost
721 somehost:161
722 somehost:161!192.168.2.4!4000 use 192.168.2.4 and port 4000 as source
723 somehost:!192.168.2.4 use 192.168.2.4 as source
724 somehost:!!4000 use port 4000 as source
725
726 timeout
727 initial timeout for SNMP queries, in seconds (default: 2.0)
728
729 retries
730 number of times a timed-out request will be retried (default:
731 5)
732
733 backoff
734 factor by which the timeout is multiplied on every retry
735 (default: 1.0).
736
737 version
738 for SNMP version. If you have a fast router you might want to
739 put a '2' here. For authenticated or encrypted SNMP, you can
740 try to put a '3' here. This will make mrtg try to poll the 64
741 bit counters and thus prevent excessive counter wrapping. Not
742 all routers support this though. SNMP v3 requires additional
743 setup, see SnmpOptions[] for full details.
744
745 Example:
746
747 3:public@router1:::::2
748
749 name
750 the name of the subroutine that MRTG will call to convert the
751 input and output values to integers. See the complete example
752 under the global keyword "ConversionCode" above.
753
754 Example:
755
756 1.3.6.1.4.1.999.1&1.3.6.1.4.1.999.2:public@mydevice:161::::2|Length2Int
757
758 This would retrieve values from the OID 1.3.6.1.4.1.999.1 for
759 input and .2 for output on mydevice using UDP port 161 and SNMP
760 version 2, and would execute the user-defined numeric conver‐
761 sion subroutine Length2Int to convert those values to integers.
762
763 A value that equals the default value can be omitted. Trailing
764 colons can be omitted, too. The pipe symbol followed by the name
765 parameter, if present, must come at the end. There must be no spa‐
766 ces around the colons or pipe symbol.
767
768 Example:
769
770 Target[ezci]: 1:public@ezci-ether.domain:9161::4
771
772 This would refer to the input/output octet counters for the inter‐
773 face with ifIndex 1 on ezci-ether.domain, as known by the SNMP
774 agent listening on UDP port 9161. The standard initial timeout
775 (2.0 seconds) is used, but the number of retries is set to four.
776 The backoff value is the default.
777
778 Numeric IPv6 addresses
779 If IPv6 is enabled you may also specify a target using its IPv6
780 address. To avoid ambiguity with the port number, numeric IPv6
781 addresses must be placed in square brackets.
782
783 Example:
784
785 Target[IPv6test]: 2:public@[2001:760:4::]:6161::4
786
787 External Monitoring Scripts
788 If you want to monitor something which does not provide data via
789 snmp you can use some external program to do the data gathering.
790
791 The external command must return 4 lines of output:
792
793 Line 1
794 current state of the first variable, normally 'incoming bytes
795 count'
796
797 Line 2
798 current state of the second variable, normally 'outgoing bytes
799 count'
800
801 Line 3
802 string (in any human readable format), telling the uptime of
803 the target.
804
805 Line 4
806 string, telling the name of the target.
807
808 Depending on the type of data your script returns you might want to
809 use the 'gauge' or 'absolute' arguments for the Options keyword.
810
811 Example:
812
813 Target[myrouter]: `/usr/local/bin/df2mrtg /dev/dsk/c0t2d0s0`
814
815 Note the use of the backticks (`), not apostrophes (') around the
816 command.
817
818 If you want to use a backtick in the command name this can be done
819 but you must escape it with a backslash ...
820
821 If your script does not have any data to return but does not want
822 mrtg to complain about invalid data, it can return 'UNKNOWN'
823 instead of a number. Note though that only rrdtool is realy
824 equipped to handle unknown data well.
825
826 Multi Target Syntax
827 You can also combine several target definitions in a mathematical
828 expression. Any syntactically correct expression that the Perl
829 interpreter can evaluate to will work. An expression could be used,
830 for example, to aggregate both B channels in an ISDN connection or
831 to calculate the percentage hard disk utilization of a server from
832 the absolute used space and total capacity.
833
834 Examples:
835
836 Target[myrouter]: 2:public@wellfleetA + 1:public@wellfleetA
837
838 Target[myrouter]: .1.3.6.1.4.1.999.1&.1.3.6.1.4.1.999.2:public@mydevice /
839 .1.3.6.1.4.1.999.3&.1.3.6.1.4.1.999.4:public@mydevice * 100
840
841 Note that whitespace must surround each target definition in the
842 expression. Target definitions themselves must not contain white‐
843 space, except in interface descriptions and interface names, where
844 each whitespace character is escaped by a backslash.
845
846 MRTG automatically rounds the result of the expression to an inte‐
847 ger unless RRDTool logging is in use and the gauge option is in
848 effect for the target. Internally MRTG uses Perl's Math::BigFloat
849 package to calculate the result of the expression with 40 digits of
850 precision. Even in extreme cases, where, for example, you take the
851 difference of two 64-bit integers, the result of the expression
852 should be accurate.
853
854 SNMP Request Optimization
855 MRTG is designed to economize on its SNMP requests. Where a target
856 definition appears more than once in the configuration file, MRTG
857 requests the data from the device only once per round of data col‐
858 lection and uses the collected data for each instance of a particu‐
859 lar target. Recognition of two target definitions as being identi‐
860 cal is based on a simple string match rather than any kind of
861 deeper semantic analysis.
862
863 Example:
864
865 Target[Targ1]: 1:public@CiscoA
866 Target[Targ2]: 2:public@CiscoA
867 Target[Targ3]: 1:public@CiscoA + 2:public@CiscoA
868 Target[Targ4]: 1:public@CISCOA
869
870 This results in a total of three SNMP requests. Data for 1:pub‐
871 lic@CiscoA and 2:public@CiscoA are requested only once each, and
872 used for Targ1, Targ2, and Targ3. Targ4 causes another SNMP request
873 for 1:public@CISCOA, which is not recognized as being identical to
874 1:public@CiscoA.
875
876 MaxBytes
877
878 The maximum value either of the two variables monitored are allowed to
879 reach. For monitoring router traffic this is normally the bytes per
880 second this interface port can carry.
881
882 If a number higher than MaxBytes is returned, it is ignored. Also read
883 the section on AbsMax for further info. The MaxBytes value is also
884 used in calculating the Y range for unscaled graphs (see the section on
885 Unscaled).
886
887 Since most links are rated in bits per second, you need to divide their
888 maximum bandwidth (in bits) by eight (8) in order to get bytes per sec‐
889 ond. This is very important to make your unscaled graphs display real‐
890 istic information. T1 = 193000, 56K = 7000, 10 MB Ethernet = 1250000,
891 100 MB Ethernet = 12500000. The MaxBytes value will be used by mrtg to
892 decide whether it got a valid response from the router.
893
894 If you need two different MaxBytes values for the two monitored vari‐
895 ables, you can use MaxBytes1 and MaxBytes2 instead of MaxBytes.
896
897 Example:
898
899 MaxBytes[myrouter]: 1250000
900
901 Title
902
903 Title for the HTML page which gets generated for the graph.
904
905 Example:
906
907 Title[myrouter]: Traffic Analysis for Our Nice Company
908
910 PageTop
911
912 Things to add to the top of the generated HTML page. Note that you can
913 have several lines of text as long as the first column is empty.
914
915 Note that the continuation lines will all end up on the same line in
916 the html page. If you want linebreaks in the generated html use the
917 '\n' sequence.
918
919 Example:
920
921 PageTop[myrouter]: <H1>Traffic Analysis for ETZ C95.1</H1>
922 Our Campus Backbone runs over an FDDI line\n
923 with a maximum transfer rate of 12.5 megabytes per
924 Second.
925
926 RouterUptime
927
928 In cases where you calculate the used bandwidth from several interfaces
929 you normaly don't get the router uptime and router name displayed on
930 the web page.
931
932 If these interfaces are on the same router and the uptime and name
933 should be displayed you have to specify its community and address again
934 with the RouterUptime keyword.
935
936 If you want to use a special OID for queriing the router uptime, use
937 prepend the oid.
938
939 Example:
940
941 Target[kacisco.comp.edu]: 1:public@194.64.66.250 + 2:public@194.64.66.250
942 RouterUptime[kacisco.comp.edu]: public@194.64.66.250
943
944 RouterUptime[kacisco.comp.edu]: hrSystemUptime.0:public@194.64.66.250
945
946 RouterName
947
948 If the default name of the router is incorrect/uninformative, you can
949 use RouterName to specify a different OID on either the same or a dif‐
950 ferent host.
951
952 A practical example: sysName on BayTech DS72 units always display
953 "ds72", no matter what you set the Unit ID to be. Instead, the Unit ID
954 is stored at 1.3.6.1.4.1.4779.1.1.3.0, so we can have MRTG display this
955 instead of sysName.
956
957 Example:
958
959 RouterName[kacisco.comp.edu]: 1.3.6.1.4.1.4779.1.1.3.0
960
961 A different OID on a different host can also be specified:
962
963 RouterName[kacisco.comp.edu]: 1.3.6.1.4.1.4779.1.1.3.0:public@194.64.66.251
964
965 MaxBytes1
966
967 Same as MaxBytes, for variable 1.
968
969 MaxBytes2
970
971 Same as MaxBytes, for variable 2.
972
973 IPv4Only
974
975 Many IPv6 routers do not currently support SNMP over IPv6 and must be
976 monitored using IPv4. The IPv4Only option forces mrtg to use IPv4 when
977 communicating with the target, even if IPv6 is enabled. This is useful
978 if the target is a hostname with both IPv4 and IPv6 addresses; without
979 the IPv4Only keyword, monitoring such a router will not work if IPv6 is
980 enabled.
981
982 If set to no (the default), mrtg will use IPv6 unless the target has no
983 IPv6 addresses, in which case it will use IPv4. If set to yes, mrtg
984 will only use IPv4.
985
986 Note that if this option is set to yes and the target does not have an
987 IPv4 address, communication with the target will fail.
988
989 This option has no effect if IPv6 is not enabled.
990
991 Example:
992
993 Target[v4onlyrouter_1]: 1:public@v4onlyrouter
994 IPv4Only[v4onlyrouter_1]: Yes
995
996 SnmpOptions (V3)
997
998 SNMPv3 requires a fairly rich set of options. This per-target keyword
999 allows access to the User Security Model of SNMPv3. Options are listed
1000 in the same syntax as a perl hash.
1001
1002 Security Modes
1003
1004 SNMPv3 has three security modes, defined on the device being polled.
1005 For example, on Cisco routers the security mode is defined by the snmp-
1006 server group global configuration command.
1007
1008 NoAuthNoPriv
1009 Neither Authentication nor Privacy is defined. Only the Username
1010 option is specified for this mode.
1011
1012 Example:
1013
1014 SnmpOptions[myrouter]: username=>'user1'
1015
1016 AuthNoPriv
1017 Uses a Username and a password. The password can be hashed using
1018 the snmpkey application, or passed in plain text along with the
1019 ContextEngineID
1020
1021 Example:
1022
1023 SnmpOptions[myrouter]: username=>'user1',authpassword=>'example',
1024 contextengineid=>'80000001110000004000000'
1025
1026 Priv
1027 Both Authentication and Privacy is defined. The default privacy
1028 protocol is des.
1029
1030 Example:
1031 SnmpOptions[myrouter]:
1032 authkey=>'0x1e93ab5a396e2af234c8920e61cfe2028072c0e2',
1033 authprotocol=>'sha',privprotocol=>'des',username=>'user1',
1034 privkey=>'0x498d74940c5872ed387201d74b9b25e2'
1035
1036 snmp options
1037
1038 The following option keywords are recognized:
1039
1040 username
1041 The user associated with the User Security Model
1042
1043 contextname
1044 An SNMP agent can define multiple contexts. This keyword allows
1045 them to be polled.
1046
1047 contextengineid
1048 A unique 24-byte string identifying the snmp-agent.
1049
1050 authpassword
1051 The plaintext password for a user in either AuthNoPriv or Priv
1052 mode.
1053
1054 authkey
1055 A md5 or sha hash of the plain-text password, along with the
1056 engineid. Use the snmpkey commandline program to generate this
1057 hash, or use Net::SNMP::Security::USM in a script.
1058
1059 authprotocol {sha|md5}
1060 The hashing algorithm defined on the SNMP client. Defaults to md5.
1061
1062 privpassword
1063 A plaintext pre-shared key for encrypting snmp packets in Priv
1064 mode.
1065
1066 privkey
1067 A hash of the plain-text pre-shared key, along with the engineid.
1068 Use the snmpkey commandline program to generate this hash, or use
1069 Net::SNMP::Security::USM in a script.
1070
1071 privprotocol {des|3desede|aescfb128|aescfb192|aescfb256}
1072 Specifies the encryption method defined on the snmp agent. The
1073 default is des.
1074
1075 PageFoot
1076
1077 Things to add to the bottom of the generated HTML page. Note that you
1078 can have several lines of text as long as the first column is empty.
1079
1080 Note that the continuation lines will all end up on the same line in
1081 the html page. If you want linebreaks in the generated html use the
1082 '\n' sequence.
1083
1084 The material will be added just before the </BODY> tag:
1085
1086 Example:
1087
1088 PageFoot[myrouter]: Contact <A HREF="mailto:peter@x.yz">Peter</A>
1089 if you have questions regarding this page
1090
1091 AddHead
1092
1093 Use this tag like the PageTop header, but its contents will be added
1094 between </TITLE> and </HEAD>.
1095
1096 Example:
1097
1098 AddHead[myrouter]: <link rev="made" href="mailto:mrtg@blabla.edu">
1099
1100 BodyTag
1101
1102 BodyTag lets you supply your very own <body ...> tag for the generated
1103 webpages.
1104
1105 Example:
1106
1107 BodyTag[myrouter]: <BODY LEFTMARGIN="1" TOPMARGIN="1"
1108 BACKGROUND="/stats/images/bg.neo2.gif">
1109
1110 AbsMax
1111
1112 If you are monitoring a link which can handle more traffic than the
1113 MaxBytes value. Eg, a line which uses compression or some frame relay
1114 link, you can use the AbsMax keyword to give the absolute maximum value
1115 ever to be reached. We need to know this in order to sort out unrealis‐
1116 tic values returned by the routers. If you do not set AbsMax, rateup
1117 will ignore values higher than MaxBytes.
1118
1119 Example:
1120
1121 AbsMax[myrouter]: 2500000
1122
1123 Unscaled
1124
1125 By default each graph is scaled vertically to make the actual data vis‐
1126 ible even when it is much lower than MaxBytes. With the Unscaled vari‐
1127 able you can suppress this. It's argument is a string, containing one
1128 letter for each graph you don't want to be scaled: d=day w=week m=month
1129 y=year. There is also a special case to unset the variable completely:
1130 n=none. This could be useful in the event you need to override a global
1131 configuration. In the example scaling for the yearly and the monthly
1132 graph are suppressed.
1133
1134 Example:
1135
1136 Unscaled[myrouter]: ym
1137
1138 WithPeak
1139
1140 By default the graphs only contain the average values of the monitored
1141 variables - normally the transfer rates for incoming and outgoing traf‐
1142 fic. The following option instructs mrtg to display the peak 5 minute
1143 values in the [w]eekly, [m]onthly and [y]early graph. In the example we
1144 define the monthly and the yearly graph to contain peak as well as
1145 average values.
1146
1147 Examples:
1148
1149 WithPeak[myrouter]: ym
1150
1151 Suppress
1152
1153 By default mrtg produces 4 graphs. With this option you can suppress
1154 the generation of selected graphs. The option value syntax is analo‐
1155 gous to the above two options. In this example we suppress the yearly
1156 graph as it is quite empty in the beginning.
1157
1158 Example:
1159
1160 Suppress[myrouter]: y
1161
1162 Extension
1163
1164 By default, mrtg creates .html files. Use this option to tell mrtg to
1165 use a different extension. For example you could set the extension to
1166 php3, then you will be able to enclose PHP tags into the output (useful
1167 for getting a router name out of a database).
1168
1169 Example:
1170
1171 Extension[myrouter]: phtml
1172
1173 Directory
1174
1175 By default, mrtg puts all the files that it generates for each target
1176 (the GIFs, the HTML page, the log file, etc.) in WorkDir.
1177
1178 If the Directory option is specified, the files are instead put into a
1179 directory under WorkDir or Log-, Image- and HtmlDir). (For example the
1180 Directory option below would cause all the files for a target myrouter
1181 to be put into directory /usr/tardis/pub/www/stats/mrtg/myrouter/ .)
1182
1183 The directory must already exist; mrtg will not create it.
1184
1185 Example:
1186
1187 WorkDir: /usr/tardis/pub/www/stats/mrtg
1188 Directory[myrouter]: myrouter
1189
1190 NOTE: the Directory option must always be 'relative' or bad things will
1191 happen.
1192
1193 Clonedirectory
1194
1195 If the Directory option is specified, the Clonedirectory option will
1196 copy all the contents of Directory to the Clonedirectory.
1197
1198 As well as the Directory option requires, the clone directory must
1199 already exist; mrtg will not create it.
1200
1201 Example:
1202
1203 WorkDir: /usr/tardis/pub/www/stats/mrtg
1204 Directory[myrouter]: myrouter
1205 Clonedirectory[myrouter]: myclonedirectory
1206
1207 NOTE: the Clonedirectory option must always be 'relative' or bad things
1208 will happen.
1209
1210 XSize and YSize
1211
1212 By default mrtgs graphs are 100 by 400 pixels wide (plus some more for
1213 the labels. In the example we get almost square graphs ...
1214
1215 Note: XSize must be between 20 and 600; YSize must be larger than 20
1216
1217 Example:
1218
1219 XSize[myrouter]: 300
1220 YSize[myrouter]: 300
1221
1222 XZoom and YZoom
1223
1224 If you want your graphs to have larger pixels, you can "Zoom" them.
1225
1226 Example:
1227
1228 XZoom[myrouter]: 2.0
1229 YZoom[myrouter]: 2.0
1230
1231 XScale and YScale
1232
1233 If you want your graphs to be actually scaled use XScale and YScale.
1234 (Beware: while this works, the results look ugly (to be frank) so if
1235 someone wants to fix this: patches are welcome.
1236
1237 Example:
1238
1239 XScale[myrouter]: 1.5
1240 YScale[myrouter]: 1.5
1241
1242 YTics and YTicsFactor
1243
1244 If you want to show more than 4 lines per graph, use YTics. If you
1245 want to scale the value used for the YLegend of these tics, use YTics‐
1246 Factor. The default value for YTics is 4 and the default value for
1247 YTicsFactor is 1.0 .
1248
1249 Example:
1250
1251 Suppose you get values ranging from 0 to 700. You want to plot 7 lines
1252 and want to show 0, 1, 2, 3, 4, 5, 6, 7 instead of 0, 100, 200, 300,
1253 400, 500, 600, 700. You should write then:
1254
1255 YTics[myrouter]: 7
1256 YTicsFactor[myrouter]: 0.01
1257
1258 Factor
1259
1260 If you want to multiply all numbers shown below the graph with a con‐
1261 stant factor, use this directive to define it ..
1262
1263 Example:
1264
1265 Factor[as400]: 4096
1266
1267 Step
1268
1269 Change the default step from 5 * 60 seconds to something else (I have
1270 not tested this much ...)
1271
1272 Example:
1273
1274 Step[myrouter]: 60
1275
1276 PNGTitle
1277
1278 When using rateup for graph generation, this will print the given title
1279 in the graph it generates.
1280
1281 Example:
1282
1283 PNGTitle[myrouter]: WAN Link UK-US
1284
1285 Options
1286
1287 The Options Keyword allows you to set some boolean switches:
1288
1289 growright
1290 The graph grows to the left by default. This option flips the
1291 direction of growth causing the current time to be at the right
1292 edge of the graph and the history values to the left of it.
1293
1294 bits
1295 All the monitored variable values are multiplied by 8 (i.e. shown
1296 in bits instead of bytes) ... looks much more impressive :-) It
1297 also affects the 'factory default' labeling and units for the given
1298 target.
1299
1300 perminute
1301 All the monitored variable values are multiplied by 60 (i.e. shown
1302 in units per minute instead of units per second) in case of small
1303 values more accurate graphs are displayed. It also affects the
1304 'factory default' labeling and units for the given target.
1305
1306 perhour
1307 All the monitored variable values are multiplied by 3600 (i.e.
1308 shown in units per hour instead of units per second) in case of
1309 small values more accurate graphs are displayed. It also affects
1310 the 'factory default' labeling and units for the given target.
1311
1312 noinfo
1313 Suppress the information about uptime and device name in the gener‐
1314 ated webpage.
1315
1316 nopercent
1317 Don't print usage percentages.
1318
1319 transparent
1320 Make the background of the generated gifs transparent.
1321
1322 integer
1323 Print summary lines below graph as integers without commas.
1324
1325 dorelpercent
1326 The relative percentage of IN-traffic to OUT-traffic is calculated
1327 and displayed in the graph as an additional line. Note: Only a
1328 fixed scale is available (from 0 to 100%). Therefore if IN-traffic
1329 is greater than OUT-traffic then 100% is displayed. If you suspect
1330 that your IN-traffic is not always less than or equal to your OUT-
1331 traffic you are urged to not use this options. Note: If you use
1332 this option in combination with the Colours options, a fifth
1333 colour-name colour-value pair is required there.
1334
1335 avgpeak
1336 There are some ISPs who use the average Peak values to bill their
1337 customers. Using this option MRTG displays these values for each
1338 graph. The value is built by averaging the max 5 minute traffic
1339 average for each 'step' shown in the graph. For the Weekly graph
1340 this means that it builds the average of all 2 hour intervals 5
1341 minute peak values. (Confused? Thought so!)
1342
1343 gauge
1344 Treat the values gathered from target as 'current status' measure‐
1345 ments and not as ever incrementing counters. This would be useful
1346 to monitor things like disk space, processor load, temperature, and
1347 the like ...
1348
1349 In the absence of 'gauge' or 'absolute' options, MRTG treats vari‐
1350 ables as a counters and calculates the difference between the cur‐
1351 rent and the previous value and divides that by the elapsed time
1352 between the last two readings to get the value to be plotted.
1353
1354 absolute
1355 This is for counter type data sources which reset their value when
1356 they are read. This means that rateup does not have to build the
1357 difference between the current and the last value read from the
1358 data source. The value obtained is still divided by the elapsed
1359 time between the current and the last reading, which makes it dif‐
1360 ferent from the 'gauge' option. Useful for external data gatherers.
1361
1362 derive
1363 If you are using rrdtool as logger/grapher you can use a third type
1364 of data source. Derive is like counter, except that it is not
1365 required to go UP all the time. It is useful for situations where
1366 the change of some value should be graphed.
1367
1368 unknaszero
1369 Log unknown data as zero instead of the default behaviour of
1370 repeating the last value seen. Be careful with this, often a flat
1371 line in the graph is much more obvious than a line at 0.
1372
1373 withzeroes
1374 Normally we ignore all values which are zero when calculating the
1375 average transfer rate on a line. If this is not desirable use this
1376 option.
1377
1378 noborder
1379 If you are using rateup to log data, MRTG will create the graph
1380 images. Normally these images have a shaded border around them. If
1381 you do not want the border to be drawn, enable this option. This
1382 option has no effect if you are not using rateup.
1383
1384 noarrow
1385 As with the option above, this effects rateup graph generation
1386 only. Normally rateup will generate graphs with a small arrow show‐
1387 ing the direction of the data. If you do not want this arrow to be
1388 drawn, enable this option. This option has no effect if you are not
1389 using rateup.
1390
1391 noi When using rateup for graph generation, you can use this option to
1392 stop rateup drawing a graph for the 'I' or first variable. This
1393 also removes entries for this variable in the HTML page MRTG gener‐
1394 ates, and will remove the peaks for this variable if they are
1395 enabled. This allows you to hide this data, or can be very useful
1396 if you are only graphing one line of data rather than two. This
1397 option is not destructive - any data received for the the variable
1398 continued to be logged, it just isn't shown.
1399
1400 noo Same as above, except relating to the 'O' or second variable.
1401
1402 nobanner
1403 When using rateup for graph generation, this option disables MRTG
1404 adding the MRTG banner to the HTML pages it generates.
1405
1406 nolegend
1407 When using rateup for graph generation, this option will stop MRTG
1408 from creating a legend at the bottom of the HTML pages it gener‐
1409 ates.
1410
1411 printrouter
1412 When using rateup for graph generation, this option will print the
1413 router name in the graph it generates. This option is overridden
1414 by the value of PNGTitle if one is given
1415
1416 pngdate
1417 When using rateup for graph generation, this option will print a
1418 timestamp in the graph it generates, including a timezone if one is
1419 specified by the 'Timezone' parameter.
1420
1421 logscale
1422 The logscale option causes rateup to display the data with the Y
1423 axis scaled logarithmically. Doing so allows the normal traffic to
1424 occupy the majority of the vertical range, while still showing any
1425 spikes at their full height.
1426
1427 logscale displays all the available data and will always produce
1428 well-behaved graphs. People often consider a logarithmically
1429 scaled graph counterintuitive, however, and thus hard to interpret.
1430
1431 expscale
1432 The expscale option causes rateup to display the data with the Y
1433 axis scaled exponentially. Doing so emphasizes small changes at
1434 the top of the scale; this can be useful when graphing values that
1435 fluctuate by a small amount near the top of the scale, such as line
1436 voltage.
1437
1438 expscale is essentially the inverse of logscale.
1439
1440 secondmean
1441 The secondmean option sets the maximum value on the graph to the
1442 mean of the data greater than the mean of all data. This produces
1443 a graph that focuses more on the typical data, while clipping large
1444 peaks.
1445
1446 Using secondmean will give a more intutive linearly scaled graph,
1447 but can result in a uselessly high or low scale in some rare situa‐
1448 tions (specifically, when the data includes a large portion of val‐
1449 ues far from the actual mean)
1450
1451 If a target includes both logscale and secondmean in the options,
1452 the secondmean takes precedence.
1453
1454 Example:
1455
1456 Options[myrouter]: growright, bits
1457
1458 kilo
1459
1460 Use this option to change the multiplier value for building prefixes.
1461 Defaultvalue is 1000. This tag is for the special case that 1kB =
1462 1024B, 1MB = 1024kB and so far.
1463
1464 Example:
1465
1466 kilo[myrouter]: 1024
1467
1468 kMG
1469
1470 Change the default multiplier prefixes (,k,M,G,T,P). In the tag Short‐
1471 Legend define only the basic units. Format: Comma seperated list of
1472 prefixed. Two consecutive commas or a comma at start or end of the line
1473 gives no prefix on this item. If you do not want prefixes, just put
1474 two consecutive commas. If you want to skip a magnitude select '-' as
1475 value.
1476
1477 Example: velocity in nm/s (nanometers per second) displayed in nm/h.
1478
1479 ShortLegend[myrouter]: m/h
1480 kMG[myrouter]: n,u,m,,k,M,G,T,P
1481 options[myrouter]: perhour
1482
1483 Colours
1484
1485 The Colours tag allows you to override the default colour scheme.
1486 Note: All 4 of the required colours must be specified here. The colour
1487 name ('Colourx' below) is the legend name displayed, while the RGB
1488 value is the real colour used for the display, both on the graph and in
1489 the html doc.
1490
1491 Format is: Col1#RRGGBB,Col2#RRGGBB,Col3#RRGGBB,Col4#RRGGBB
1492
1493 Important: If you use the dorelpercent options tag a fifth colour name
1494 colour value pair is required:
1495 Col1#RRGGBB,Col2#RRGGBB,Col3#RRGGBB,Col4#RRGGBB,Col5#RRGGBB
1496
1497 Colour1
1498 First variable (normally Input) on default graph.
1499
1500 Colour2
1501 Second variable (normally Output) on default graph.
1502
1503 Colour3
1504 Max first variable (input).
1505
1506 Colour4
1507 Max second variable (output).
1508
1509 RRGGBB
1510 2 digit hex values for Red, Green and Blue.
1511
1512 Example:
1513
1514 Colours[myrouter]: GREEN#00eb0c,BLUE#1000ff,DARK GREEN#006600,VIOLET#ff00ff
1515
1516 Background
1517
1518 With the Background tag you can configure the background colour of the
1519 generated HTML page.
1520
1521 Example:
1522
1523 Background[myrouter]: #a0a0a0a
1524
1525 YLegend, ShortLegend, Legend[1234]
1526
1527 The following keywords allow you to override the text displayed for the
1528 various legends of the graph and in the HTML document:
1529
1530 YLegend
1531 The Y-axis label of the graph. Note that a text which is too long
1532 to fit in the graph will be silently ignored.
1533
1534 ShortLegend
1535 The units string (default 'b/s') used for Max, Average and Current
1536
1537 Legend[1234IO]
1538 The strings for the colour legend.
1539
1540 Example:
1541
1542 YLegend[myrouter]: Bits per Second
1543 ShortLegend[myrouter]: b/s
1544 Legend1[myrouter]: Incoming Traffic in Bits per Second
1545 Legend2[myrouter]: Outgoing Traffic in Bits per Second
1546 Legend3[myrouter]: Maximal 5 Minute Incoming Traffic
1547 Legend4[myrouter]: Maximal 5 Minute Outgoing Traffic
1548 LegendI[myrouter]: In:
1549 LegendO[myrouter]: Out:
1550
1551 Note, if LegendI or LegendO are set to an empty string with
1552
1553 LegendO[myrouter]:
1554
1555 The corresponding line below the graph will not be printed at all.
1556
1557 Timezone
1558
1559 If you live in an international world, you might want to generate the
1560 graphs in different timezones. This is set in the TZ variable. Under
1561 certain operating systems like Solaris, this will provoke the localtime
1562 call to give the time in the selected timezone.
1563
1564 Example:
1565
1566 Timezone[myrouter]: Japan
1567
1568 The Timezone is the standard timezone of your system, ie Japan,
1569 Hongkong, GMT, GMT+1 etc etc.
1570
1571 Weekformat
1572
1573 By default, mrtg (actually rateup) uses the strftime(3) '%V' option to
1574 format week numbers in the monthly graphs. The exact semantics of this
1575 format option vary between systems. If you find that the week numbers
1576 are wrong, and your system's strftime(3) routine supports it, you can
1577 try another format option. The POSIX '%V' option correspond to the
1578 widely used ISO 8601 week numbering standard. The week format charac‐
1579 ter should be specified as a single letter; either W, V, or U.
1580
1581 The UNIX version of rateup uses the libc implementation of strftime.
1582 On Windows, the native strftime implementation does not know about %V.
1583 So there we use a different implementation of strftime that does sup‐
1584 port %V.
1585
1586 Example:
1587
1588 Weekformat[myrouter]: W
1589
1590 RRDRowCount
1591
1592 This affects the creation of new rrd files. By default rrds are created
1593 to hold about 1 day's worth of high resolution data. (plus 1 week of 30
1594 minute data, 2 months of 2 hour data and 2 years of 1 day data). With
1595 this Keyword you can change the number of base interval entries config‐
1596 ured for new rrds as they get created. Note that you must take the
1597 interval time into account.
1598
1599 Example:
1600
1601 RRDRowCount[myrouter]: 1600
1602
1603 RRDHWRRAs
1604
1605 Normally the RRDs created by MRTG will just contain the information
1606 gathered directly from the respective target. With this option you can
1607 tap into rrdtools advanced aberrant behaviour detection module based on
1608 Holt-Winters forecasting. The RRDHWRRAs property specifies the Holt-
1609 Winters RRAs as described in the rrdcreate manual page.
1610
1611 Note, this setting will only affect newly created RRDs (targets).
1612
1613 Example:
1614
1615 RRDHWRRAs[myrouter]: RRA:HWPREDICT:1440:0.1:0.0035:288
1616
1617 TimeStrPos
1618
1619 This defines placement of the timestamp string on the image. Possible
1620 values are RU, LU, RL, LL (which stand, respectively, for RightUpper,
1621 LeftUpper, RightLower and LeftLower corner) and NO (for no timestamp).
1622 By default, no timestamp is placed on the image.
1623
1624 Example:
1625
1626 TimeStrPos[myrouter]: RU
1627
1628 TimeStrFmt
1629
1630 Using this keyword you may specify format of the timestamp to be placed
1631 on the image (if enabled by the TimeStrPos keyword). Specified string
1632 will be used by the strftime() function - see strftime(3) documentation
1633 for conversion specifiers available on your system. Default format:
1634 %Y-%m-%d %H:%M
1635
1636 Example:
1637
1638 TimeStrFmt[myrouter]: %H:%M:%S
1639
1641 Through its threshold checking functionality mrtg is able to detect
1642 threshold problems for the various targets and can call external
1643 scripts to handle those problems (e.g. send email or a page to an
1644 administrator).
1645
1646 Threshold checking is configured through the following parameters:
1647
1648 ThreshDir (GLOBAL)
1649
1650 By defining ThreshDir to point to a writable directory, MRTG will only
1651 alert you when a threshold boundery has been crossed.
1652
1653 Example:
1654
1655 ThreshDir: /var/mrtg/thresh
1656
1657 ThreshHyst (GLOBAL)
1658
1659 If a threshold is broken, and you have a threshdir defined, then mrtg
1660 will send mail once the threshold becomes 'unborken' to avoid situa‐
1661 tions where broken and un-broken messages get sent in close succession,
1662 we only send an unbroken message once the curent value is 0.1 (10%)
1663 away from the threshold. using the ThreshHyst config variable you can
1664 customize this value.
1665
1666 Example for 5%:
1667
1668 ThreshHyst: 0.05
1669
1670 ThreshMailServer (GLOBAL)
1671
1672 Adderss of an SMTP server which is going to accept mail about Thresh‐
1673 olds being broken and unbroken.
1674
1675 ThreshMailSender (GLOBAL)
1676
1677 What is the sender address of the threshold mail.
1678
1679 Example:
1680
1681 ThreshMailSender: mrtg@example.com
1682
1683 ThreshMailAddress (PER TARGET)
1684
1685 Email address for Threshold related Mails. This will only work if a
1686 mailserver has been configured.
1687
1688 Example:
1689
1690 ThreshMailAddress[_]: admin@example.com
1691 ThreshMailAddress[router]:
1692
1693 This would bring threshold releaed mail to all but the target called
1694 'router'.
1695
1696 ThreshMinI (PER TARGET)
1697
1698 This is the minimum acceptable value for the Input (first) parameter.
1699 If the parameter falls below this value, the program specified in
1700 ThreshProgI will be run and a mail will be sent to the ThreshMailAd‐
1701 dress if specified. If the value ends in '%' then the threshold is
1702 defined relative to MaxBytes.
1703
1704 ThreshMaxI (PER TARGET)
1705
1706 Works the same as TheshMinI but it acts when the value is higher than
1707 ThreshMaxI.
1708
1709 ThreshDesc (PER TARGET)
1710
1711 Its value will be assigned to the environment variable THRESH_DESC
1712 before any of the programs mentioned below are called. The programms
1713 can use the value of this variable to produce more user-friendly out‐
1714 put.
1715
1716 ThreshProgI (PER TARGET)
1717
1718 This defines a program to be run if ThreshMinI or ThreshMaxI is broken.
1719 MRTG passes 3 arguments: the $router variable, the threshold value bro‐
1720 ken, and the current parameter value.
1721
1722 ThreshProgOKI (PER TARGET)
1723
1724 This defines a program to be run if the parameter is currently OK
1725 (based on ThreshMinI and ThreshMaxI), but wasn't OK on the previous
1726 running -- based on the files found in ThreshDir. MRTG passes 3 argu‐
1727 ments: the $router variable the unbroken threshold value, and the cur‐
1728 rent parameter value.
1729
1730 ThreshMinO, ThreshMaxO, ThreshProgO, and ThreshProgOKO
1731
1732 These work the same as their *I counterparts, except on the Output
1733 (second) parameter.
1734
1735 SetEnv
1736
1737 When calling threshold scripts from within your cfg file you might want
1738 to pass some data on to the script. This can be done with the SetEnv
1739 configuration option which takes a series of environment variable
1740 assignments. Note that the quotes are mandatory. This does not work for
1741 external scripts. It is not possible to set environment variables per
1742 target.
1743
1744 Example:
1745
1746 SetEnv[myrouter]: EMAIL="contact_email@someplace.net"
1747 HOST="www.some_server.net"
1748
1749 HW Failure Bassed Threshold Checking
1750
1751 When using rrd based logging with HW RRAs defined. You can use the con‐
1752 fidence bounds violations stored in the FAILURES RRA for threshold
1753 based alerts.
1754
1755 There the all target specific threshold variables have a Hold-Winters
1756 counterpart:
1757
1758 ThreshMailAddress -> HWThreshMailAddress
1759 ThreshMinI -> HWThreshMinI
1760 ...
1761
1762 The global variables for threshold checking are shared except for the
1763
1764 ThreshHyst -> HWThreshHyst
1765
1766 And HWThreshDesc sets the HWTHRESH_DESC variable.
1767
1769 Pre- and Postfix
1770
1771 To save yourself some typing you can define a target called '^'. The
1772 text of every Keyword you define for this target will be PREPENDED to
1773 the corresponding Keyword of all the targets defined below this line.
1774 The same goes for a Target called '$' but its text will be APPENDED.
1775
1776 Note that a space is inserted between the prepended text and the Key‐
1777 word value, as well as between the Keyword value and the appended text.
1778 This works well for text-valued Keywords, but is not very useful for
1779 other Keywords. See the "default" target description below.
1780
1781 The example will make mrtg use a common header and a common contact
1782 person in all the pages generated from targets defined later in this
1783 file.
1784
1785 Example:
1786
1787 PageTop[^]: <H1>NoWhere Unis Traffic Stats</H1><HR>
1788 PageTop[$]: Contact Peter Norton if you have any questions<HR>
1789
1790 To remove the prepend/append value, specify an empty value, e.g.:
1791
1792 PageTop[^]:
1793 PageTop[$]:
1794
1795 NoSpaceChar
1796
1797 With PREPEND and APPEND (see below) there is normally a space inserted
1798 between the local value and the PRE- or APPEND value. Sometimes this is
1799 not desirable. You can use the global option NoSpaceChar to define a
1800 character which can be mentioned at the end of a $ or ^ definition in
1801 order to supress the space.
1802
1803 Example:
1804
1805 NoSpaceChar: ~
1806 Target[^]: 1.3.6.1.4.1.482.50.2.4.20.0&1.3.6.1.4.1.482.50.2.4.21.0:get@~
1807 Target[a]: a.tolna.net
1808 Target[b]: b.tolna.net
1809 Target[c]: c.tolna.net
1810 Target[d]: d.tolna.net
1811
1812 Default Values
1813
1814 The target name '_' specifies a default value for that Keyword. In the
1815 absence of explicit Keyword value, the prepended and the appended key‐
1816 word value, the default value will be used.
1817
1818 Example:
1819
1820 YSize[_]: 150
1821 Options[_]: growright,bits,nopercent
1822 WithPeak[_]: ymw
1823 Suppress[_]: y
1824 MaxBytes[_]: 1250000
1825
1826 To remove the default value and return to the 'factory default', spec‐
1827 ify an empty value, e.g.:
1828
1829 YLegend[_]:
1830
1831 There can be several instances of setting the default/prepend/append
1832 values in the configuration file. The later setting replaces the previ‐
1833 ous one for the rest of the configuration file. The
1834 default/prepend/append values used for a given keyword/target pair are
1835 the ones that were in effect at the point in the configuration file
1836 where the target was mentioned for the first time.
1837
1838 Example:
1839
1840 MaxBytes[_]: 1250000
1841 Target[myrouter.somplace.edu.2]: 2:public@myrouter.somplace.edu
1842 MaxBytes[_]: 8000
1843 Title[myrouter.somplace.edu.2]: Traffic Analysis for myrouter.somplace.edu IF 2
1844
1845 The default MaxBytes for the target myrouter.someplace.edu.2 in the
1846 above example will be 1250000, which was in effect where the target
1847 name myrouter.someplace.edu.2 first appeared in the config file.
1848
1850 --user username and --group groupname
1851 Run as the given user and/or group. (Unix Only)
1852
1853 --lock-file filename
1854 Use an alternate lock-file (the default is to use the configura‐
1855 tion-file appended with "_l").
1856
1857 --confcache-file filename
1858 Use an alternate confcache-file (the default is to use the configu‐
1859 ration-file appended with ".ok")
1860
1861 --logging filename|eventlog
1862 If this is set to writable filename, all output from mrtg (warn‐
1863 ings, debug messages, errors) will go to filename. If you are run‐
1864 ning on Win32 you can specify eventlog instead of a filename which
1865 will send all error to the windows event log.
1866
1867 NOTE: Note, there is no Message DLL for mrtg included with mrtg.
1868 This has the side effect that the windows event logger will display
1869 a nice message with every entry in the event log, complaing about
1870 the fact that mrtg has no message dll. If you go to the mrtg con‐
1871 trib download area (on the website) you will find the mrtg-mes‐
1872 sage-dll.zip which does contain such a thing.
1873
1874 --daemon
1875 Put MRTG into the background, running as a daemon. This works the
1876 same way as the config file option, but the switch is required for
1877 proper FHS operation (because /var/run is writable only by root)
1878
1879 --fhs
1880 Configure all mrtg paths to conform to the FHS specification;
1881 http://www.pathname.com/fhs/
1882
1883 --check
1884 Only check the cfg file for errors. Do not do anything.
1885
1886 --pid-file=s
1887 Define the name and path of the pid file for mrtg running as a dae‐
1888 mon
1889
1890 --debug=s
1891 Enable debug options. The argument of the debug option is a comma
1892 separated list of debug values:
1893
1894 cfg - watch the config file reading
1895 dir - directory mangeling
1896 base - basic program flow
1897 tarp - target parser
1898 snpo - snmp polling
1899 coca - confcache operations
1900 fork - forking view
1901 time - some timing info
1902 log - logging of data via rateup or rrdtool
1903 eval - print eval strings before evaluting them
1904 prof - add hires timing info the rrd calls
1905
1906 Example:
1907
1908 --debug="cfg,snpo"
1909
1911 An exit code of 0 indicates that all targets were successful. Gener‐
1912 ally speaking, most codes greater than 0 indicate that there was an
1913 unrecoverable problem. One exception to this is code 91, which indi‐
1914 cates that at least one of the targets was succesful. A partial list‐
1915 ing of the codes follows:
1916
1917 0: All targets sucessful
1918
1919 2: Config error (can't read, fatal error in config, etc)
1920 17: Another MRTG process is processing config
1921
1922 91: At least one target sucessful
1923 92: No targets were sucessful
1924
1926 Minimal mrtg.cfg
1927
1928 WorkDir: /usr/tardis/pub/www/stats/mrtg
1929 Target[r1]: 2:public@myrouter.somplace.edu
1930 MaxBytes[r1]: 8000
1931 Title[r1]: Traffic Analysis ISDN
1932 PageTop[r1]: <H1>Stats for our ISDN Line</H1>
1933
1934 Cfg for several Routers.
1935
1936 WorkDir: /usr/tardis/pub/www/stats/mrtg
1937 Title[^]: Traffic Analysis for
1938 PageTop[^]: <H1>Stats for
1939 PageTop[$]: Contact The Chief if you notice anybody<HR>
1940 MaxBytes[_]: 8000
1941 Options[_]: growright
1942
1943 Title[isdn]: our ISDN Line
1944 PageTop[isdn]: our ISDN Line</H1>
1945 Target[isdn]: 2:public@router.somplace.edu
1946
1947 Title[backb]: our Campus Backbone
1948 PageTop[backb]: our Campus Backbone</H1>
1949 Target[backb]: 1:public@router.somplace.edu
1950 MaxBytes[backb]: 1250000
1951
1952 # the following line removes the default prepend value
1953 # defined above
1954
1955 Title[^]:
1956
1957 Title[isdn2]: Traffic for the Backup ISDN Line
1958 PageTop[isdn2]: our ISDN Line</H1>
1959 Target[isdn2]: 3:public@router.somplace.edu
1960
1962 Tobias Oetiker <tobi@oetiker.ch> and many contributors
1963
1964
1965
19662.16.2 2008-05-16 MRTG-REFERENCE(1)