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