This document describes all the configuration options understood by the mrtg software.
Include: file
Example:
Include: base-options.inc
If included files are specified with relative paths, both the current working directory and the directory containing the main config file will be searched for the files.
Example:
WorkDir: /usr/tardis/pub/www/stats/mrtg
NOTE: Workdir overrides the settings for htmldir, imagedir and logdir.
Example:
Htmldir: /www/mrtg/
Example:
Imagedir: /www/mrtg/images
Example:
Logdir: /www/mrtg/logs
For situations with high latency or a great number of devices this will speed things up considerably. It will not make things faster, though, if you query a single switch sitting next door.
As far as I know NT can not fork so this option is not available on NT.
Example:
Forks: 4
If IPv6 is enabled and the target is a hostname, mrtg will try to resolve the hostname to an IPv6 address and, if this fails, to an IPv4 address. Note that mrtg will only use IPv4 if you specify an IPv4 address or a hostname with no corresponding IPv6 address; it will not fall back to IPv4 if it simply fails to communicate with the target using IPv6. This is by design.
Note that many routers do not currently support SNMP over IPv6. Use the IPv4Only per target option for these routers.
IPv6 is disabled by default.
Example:
EnableIPv6: Yes
SNMPv3 is disabled by default.
Example:
EnableSnmpV3: yes
Example:
Refresh: 600
In this example, we tell mrtg that we will be calling it every 10 minutes. If you are calling mrtg every 5 minutes, you can leave this line commented out.
Example:
Interval: 10
Note that unless you are using rrdtool you can not set Interval to less than 5 minutes. If you are using rrdtool you can set interval down to 1 minute. Note though, setting the Interval for an rrdtool/mrtg setup will influence the initial creation of the database. If you change the interval later, all existing databases will remain at the resolution they were initially created with.
To prevent this, you can add a 'reasonability' check by specifying a maximum age for log files. If a file seems to be older, mrtg will not touch it but complain instead, giving you a chance to investigate the cause.
Example:
MaxAge: 7200
The example above will make mrtg refuse to update log files older than 2 hours (7200 seconds).
NOTE: If you are running Apache-1.2 or later, you can use the mod_expire to achieve the same effect ... see the file htaccess.txt
Example:
WriteExpires: Yes
An example of agents which do not implement base mib2 attributes are Computer Associates - Unicenter TNG Agents. CA relies on using the base OS SNMP agent in addition to its own agents to supplement the management of a system.
Example:
NoMib2: Yes
Examples
SingleRequest: Yes
timeout => $default_timeout, retries => $default_retries, backoff => $default_backoff, default_max_repetitions => $max_repetitions, use_16bit_request_ids => 1, lenient_source_port_matching => 0, lenient_source_address_matching => 1
The values behind the options indicate the current default value. Note that these settings OVERRIDE the per target timeout settings.
A per-target SnmpOptions[] keyword will override the global settings. That keyword is primarily for SNMPv3.
The 16bit request ids are the only way to query the broken SNMP implementation of SMC Barricade routers.
Example:
SnmpOptions: retries => 2, only_ip_address_matching => 0
Note that AS/400 snmp seems to be broken in a way which prevents mrtg from working with it unless
SnmpOptions: lenient_source_port_matching => 1
is set.
Example:
IconDir: /mrtgicons/
Example:
LoadMIBs: /dept/net/mibs/netapp.mib,/usr/local/lib/ft100m.mib
Currently the following laguages are supported:
big5 brazilian bulgarian catalan chinese croatian czech danish dutch eucjp french galician gb gb2312 german greek hungarian icelandic indonesia iso2022jp italian korean lithuanian malay norwegian polish portuguese romanian russian russian1251 serbian slovak slovenian spanish swedish turkish ukrainian
Example:
Language: danish
Example:
LogFormat: rrdtool
Example:
LibAdd: /usr/local/rrdtool/lib/perl/
Example:
PathAdd: /usr/local/rrdtool/bin/
Using daemon mode MRTG itself is responible for timing the measurement intervals. Therfore its important to set the Interval keyword to an apropiate value.
Note that when using daemon mode MRTG should no longer be started from cron as each new process runs forever. Instead MRTG should be started from the command prompt or by a system startup script.
If you want mrtg to run under a particular user and group (it is not recomended to run MRTG as root) then you can use the --user=user_name and --group=group_name options on the mrtg commandline.
mrtg --user=mrtg_user --group=mrtg_group mrtg.cfg
Also note that in daemon mode restarting the process is required in order to activate changes in the config file.
Under UNIX, the Daemon switch causes mrtg to fork into background after checking its config file. On Windows NT the MRTG process will detach from the console, but because the NT/2000 shell waits for its children you have to use this special start sequence when you launch the program:
start /b perl mrtg mrtg.cfg
You may have to add path information equal to what you add when you run mrtg from the commandline.
Example
RunAsDaemon: Yes Interval: 5
This makes MRTG run as a daemon beginning data collection every 5 minutes
If you are daemontools and still want to run mrtg as a daemon you can additionally specify
NoDetach: Yes
this will make mrtg run but without detaching it from the terminal.