NAME

cfgmaker - Creates mrtg.cfg files (for mrtg-2.9.11)


SYNOPSIS

cfgmaker [options] [community@]router [[options] [community@]router ...]


OPTIONS

 --ifref=nr        interface references by Interface Number (default)
 --ifref=ip                         ... by Ip Address
 --ifref=eth                        ... by Ethernet Number
 --ifref=descr                      ... by Interface Description
 --ifref=name                       ... by Interface Name
 --ifref=type                       ... by Interface Type
 --ifdesc=nr       interface description uses Interface Number (default)
 --ifdesc=ip                        ... uses Ip Address
 --ifdesc=eth                       ... uses Ethernet Number
 --ifdesc=descr                     ... uses Interface Description
 --ifdesc=name                      ... uses Interface Name
 --ifdesc=alias                     ... uses Interface Alias
 --ifdesc=type                      ... uses Interface Type
 --global "x: a"   add global config entries
 --no-down         do not look at admin or opr status of interfaces
 --show-op-down    show interfaces which are operatively down
 --descint         describe interface instead of just 'Traffic Analysis for'
 --subdirs=format  give each router its own subdirectory, naming each per 
                   "format", in which HOSTNAME and SNMPNAME will be 
                   replaced by the values of those items -- for instance,  
                   --subdirs=HOSTNAME or --subdirs="HOSTNAME (SNMPNAME)"
 --noreversedns    do not reverse lookup ip numbers
 --community=cmty  Set the default community string to "cmty" instead of
                   "public".
 --snmp-options=:[<port>][:[<tmout>][:[<retr>][:[<backoff>][:<ver>]]]]
                   Specify default SNMP options to be appended to all
                   routers following.  Individual fields can be empty.
                   Routers following might override some or all of the
                   options given to --snmp-options.
 --dns-domain=domain
                   Specifies a domain to append to the name of all
                   routers following.
 --help            brief help message
 --man             full documentation
 --version         print the version of cfgmaker
 --output=file     output filename default is STDOUT


DESCRIPTION

Cfgmaker creates MRTG configuration files based on information pulled from a router or another SNMP manageable device.

[community@]router

Community is the community name of the device you want to create a configuration for. If not specified, it defaults to 'public'; you might want to try this first if you do not know the community name of a device. If you are using the wrong comunity name you will get no response from the device.

Router is the DNS name or the IP number of an SNMP-managable device. Following the name you can specify 6 further options separated by colons. The full syntax looks like this:

router[:[prt][:[tmout][:[retr][:[backoff][:vers]]]]]

Of special interest may be the last parameter, vers. If you set this to '2' then your device will be queried with SNMP version 2 requests. This allows to poll the 64 bit traffic counters in the device and will thus work much better with fast interfaces (no more counter overrun). Note that the order in which the routers are specified on the command line do matter as the same order is used when the configuration file is generated. The first specified router has it's configuration lines genrated first, followed by the lines belonging to the next router and so on.

Configuration

Except for the --output and --global options, all options affect only the routers following them on the command line. If an option specified earlier on the command line reappears later on the command line with another value, the new value overrides the old value as far as remaining routers are concerned. This way options might be tailored for groups of routers or for individual routers.

See --output and --global for how their behaviour is affected by where or how many times they appear on the command line.

See the Examples below on how to set an option differently for multiple routers.

--help
Print a brief help message and exit.

--man
Prints the manual page and exits.

--version
Print the version of cfgmaker. This should match the version of MRTG for which config files are being created.

--ifref nr|ip|eth|descr|name
Select the interface identification method. Default is nr which identifies the router interfaces by their number. Unfortunately the interface numbering scheme in an SNMP tree can change. Some routers change their numbering when new interfaces are added, others change thier numbering every full moon just for fun.

To work around this sad problem MRTG can identify interfaces by 4 other properties. None of these works for all interfaces, but you should be able to find one which does fine for you. Note that especially ethernet addrsses can be problematic as some routers have the same ethernet address on most of their interface cards.

Select ip to identify the interface by its IP number. Use eth to use the ethernet address for identification. Use descr to use the Interface description. Or use name to use the Interface name.

If your chosen method does not allow unique interface identification on the device you are querying, cfgmaker will tell you about it.

--ifdesc nr|ip|eth|descr|name|type|alias
Select what to use as the description of the interface. The description appears in the Title[] property for the target as well as the text header in the HTML code defined in the target's PageTop[]. Default is to use nr which is just the interface number which isn't always useful to the viewer of the graphs.

There are 6 other properties which could be used. Use ip if you want to use the interface's IP-address. Use eth if you want to use the interface's ethernet address. If you want a better description, you can use either descr, name or alias. Exactly what each of these do varies between different equipment so you might need to experiment. For instance, for a serial interface on a Cisco router running IOS using name might result in "S0" being the interface description , descr might result in "Serial0" and alias might result in "Link to HQ" (provided that is what is used as the interface's description in the router's configuration).

Finally, if you want to describe the interface by it's Btype (i.e "ethernetCSMA", "propPointtoPoint" etc) you can use type. This is roughly equivalent to the --descint option above.

--community community-string
Use this to set the community for the routers following on the command line to community-string. Individual routers might overrride this community string by using the syntax community@router.

--snmp-options :[port][:[timeout][:[retries][:[backoff][:version]]]]
Use this to set the default SNMP options for all routers following on the command line. Individual values might be omitted as well as trailing colons. Note that routers might override individual (or all) values specified by --snmp-options by using the syntax

router[:[port][:[timeout][:[retries][:[backoff][:version]]]]]

--global ``bla: abc''
Use this to add global options to the generated config file. You can call --global several times to add multiple options. The line will appear in the configuration just before the config for the next router appearing on the command line.
 --global "workdir: /home/mrtg"

If you want some default Options you might want to put

 --global "options[_]: growright,bits"

Specifying --global after the last router on the command line will create a line in the configuration file which will appear after all the routers.

--noreversedns
Do not try to reverse lookup IP numbers ... a must for DNS free environments.

--no-down
Normally cfgmaker will not include interfaces which are marked anything but administratively and operationally UP. With this switch you get them all.

--show-op-down
Include interfaces which are operatively down.

--subdirs format
Give each router its own subdirectory for the HTML and graphics (or .rrd) files. The directory name is the given format string with a couple of pattern replacements. The string ``HOSTNAME'' will be replaced by the hostname of the router (however you specified it on the cfgmaker commandline -- it may be an actual hostname or just an IP address), and ``SNMPNAME'' will be replaced with the device's idea of its own name (the same name that appears on the right side of the ``Title'' lines). For instance, a call like:
 cfgmaker --subdirs=HOSTNAME__SNMPNAME public@10.10.0.18

would result in the generation of lines looking something like:

 Directory[10.10.0.18_1]: 10.10.0.18__fp2200-bothrip-1.3

--output file
Write the output from cfgmaker into the file file. The default is to use STDOUT. --output is expected to appear only once on the command line. If used multiple times, the file specified by the last --output will be used.


EXAMPLES

The first example creates a config file for router.place.xyz: the router has the community name public. Interfaces get identified by their IP number. Two global options get added to the config file. The config file gets redirected to mrtg.conf. The '\' signs at the end of the line mean that this command should be written on a single line.

 cfgmaker --global "WorkDir: /home/tobi"           \
          --global "Options[_]: growright,bits"    \
          --ifref=ip                               \
          public@router.place.xyz > mrtg.cfg

The next example creates a config file for four devices: router1.place.xyz, router2.place.xyz, switch1.place.xyz and switch2.place.xyz all with the community public.

The two routers will have --ifref set to descr whilst the two switches will use --ifref set to name. Further the routers will use --ifdesc set to alias and switch1.place.xyz will use --ifdesc set to descr whilst switch2.place.xyz use name instead.

Finally, there will be two Options lines inserted in the configuration: One will be in the beginning, whilst the other will be inserted after the lines related to the two routers but before those lines related to the switches.

 cfgmaker --global "WorkDir: /home/tobi"           \
          --global "Options[_]: growright,bits"    \
          --ifref=descr                            \
          --ifdesc=alias                           \
          public@router1.place.xyz                 \
          public@router2.place.xyz                 \
          --global "Options[_]: growright"         \
          --ifref=name                             \
          --ifdesc=descr                           \
          public@switch1.place.xyz                 \
          --ifdesc=name                            \
          public@switch2.place.xyz > mrtg.cfg

The next example demonstrates how to use the --community, --snmp-options and --dns-domain to make the command line simpler. All the equipment will use the community hidden, except for the ppp-server which use community access. All equipment uses these SNMP options: 1s timeout, 1 retry and SNMP version 2 (backoff and port is unspecified which means they use the default values). The exception again is the ppp-server which uses SNMP version 1. Finally, all the equipment is part of the domain place.xyz, except for the ppp-server which is part of the domain remote.place.xyz. Note that the latter is achieved simply by specifying the name of the ppp-server to be ppp-server.remote .

 cfgmaker --global "WorkDir: /home/tobi"           \
          --global "Options[_]: growright,bits"    \
          --dns-domain=place.xyz                   \
          --community=hidden                       \
          --snmp-options=::1:1::2                  \
          router1                                  \
          router2                                  \
          router3                                  \
          router4                                  \
          router5                                  \
          switch1                                  \
          switch2                                  \
          switch3                                  \
          switch4                                  \
          switch5                                  \
          switch6                                  \
          switch7                                  \
          access@ppp-server.remote:::::1 > mrtg.cfg


SEE ALSO

the reference manpage


AUTHOR

Tobias Oetiker <tobi@oetiker.ch> and Jakob Ilves <jakob.ilves@oracle.com>


LICENSE

GNU General Public License


COPYRIGHT

Cfgmaker is Copyright 2000 by Tobias Oetiker <tobi@oetiker.ch>