.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "CFGMAKER 1" .TH CFGMAKER 1 "2022-01-19" "2.17.10" "mrtg" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" cfgmaker \- Creates mrtg.cfg files (for mrtg\-2.17.10) .SH "SYNOPSIS" .IX Header "SYNOPSIS" cfgmaker [options] [community@]router [[options] [community@]router ...] .SH "OPTIONS" .IX Header "OPTIONS" .Vb 9 \& \-\-ifref=name interface references by Interface Name (default) \& \-\-ifref=ip ... by Ip Address \& \-\-ifref=eth ... by Ethernet Number \& \-\-ifref=descr ... by Interface Description \& \-\-ifref=nr ... by Interface Number \& \-\-ifref=type ... by Interface Type \& You may also use multiple options separated by commas, \& in which case the first available one is used: \& e.g. \-\-ifref=ip,name,nr \& \& \-\-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=catname ... uses CatOS Interface Name \& \-\-ifdesc=ppname ... uses Passport Port Name \& \-\-ifdesc=alias ... uses Interface Alias \& \-\-ifdesc=type ... uses Interface Type \& You may also use multiple options separated by commas, \& in which case the first available one is used: \& e.g. \-\-ifdesc=catname,ppname,descr,alias,ip,name,nr \& \& \-\-if\-filter=f Test every interface against filter f to decide whether \& or not to include that interface into the collection. \& Currently f is being evaluated as a Perl expression \& and it\*(Aqs truth value is used to reject or accept the \& interface. \& (Experimental, under development, might change) \& \& \-\-if\-template=templatefile \& Replace the normal target entries for the interfaces \& with an entry as specified by the contents in the file \& templatefile. The file is supposed to contain Perl \& code to be executed to generate the lines for the \& target in the configuration file. \& (Experimental, under development, might change) \& \& \-\-host\-template=templatefile \& In addition to creating targets for a host\*(Aqs interfaces \& do also create targets for the host itself as specified \& by the contents in the file templatefile. The file is \& supposed to contain Perl code to be executed to generate \& the lines for the host related targets (such as CPU, \& ping response time measurements etc.) in the config\- \& uration file. \& (Experimental, under development, might change) \& \& \-\-global "x: a" add global config entries \& \& \-\-nodefaultglobal do not include default global settings \& \& \-\-no\-down do not look at admin or opr status of interfaces \& \& \-\-show\-op\-down show interfaces which are operatively down \& \& \-\-zero\-speed=spd use this speed in bits\-per\-second as the interface \& speed for all interfaces that return a speed of 0 \& via ifSpeed/ifHighSpeed. 100Mbps = 100000000 \& \& \-\-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". \& \& \-\-enable\-ipv6 Enable IPv6 support, if the required libraries are \& present. Numeric IPv6 addresses must be enclosed \& in square brackets, e.g. public@[2001:760:4::1]:161 \& \& \-\-use\-16bit Use 16bit SNMP request IDs to query all routers. \& \& \-\-snmp\-options=:[][:[][:[][:[][:]]]] \& \& 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. \& \& \-\-nointerfaces Don\*(Aqt do generate any configuration lines for interfaces, \& skip the step of gathering interface information and \& don\*(Aqt run any interface template code. \& \& \-\-interfaces Generate configuration lines for interfaces (this is the \& default). The main purpose of this option is to negate \& an \-\-nointerfaces appearing earlier on the command line. \& \& \-\-help brief help message \& \-\-man full documentation \& \-\-version print the version of cfgmaker \& \& \-\-output=file output filename default is STDOUT .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\fBCfgmaker\fR creates \s-1MRTG\s0 configuration files based on information pulled from a router or another \s-1SNMP\s0 manageable device. .PP [\fIcommunity\fR\fB@\fR]\fIrouter\fR .PP \&\fICommunity\fR is the community name of the device you want to create a configuration for. If not specified, it defaults to '\fBpublic\fR'; you might want to try this first if you do not know the community name of a device. If you are using the wrong community name you will get no response from the device. .PP \&\fIRouter\fR is the \s-1DNS\s0 name or the \s-1IP\s0 number of an SNMP-manageable device. Following the name you can specify 6 further options separated by colons. The full syntax looks like this: .PP \&\fBrouter\fR[:[\fBprt\fR][:[\fBtmout\fR][:[\fBretr\fR][:[\fBbackoff\fR][:\fBvers\fR]]]]] .PP Of special interest may be the last parameter, \fBvers\fR. If you set this to \&'2' then your device will be queried with \s-1SNMP\s0 version 2 requests. This allows you 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 generated first, followed by the lines belonging to the next router and so on. .PP Note that the first line of the generated cfg file will contain all the commandline options you used for generating it. This is to allow for the easy 'regeneration' in case you want to add newhosts or make some other global change. .SS "Configuration" .IX Subsection "Configuration" Except for the \fB\-\-output\fR and \fB\-\-global\fR 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. .PP See \fB\-\-output\fR and \fB\-\-global\fR for how their behaviour is affected by where or how many times they appear on the command line. .PP See the \fBExamples\fR below on how to set an option differently for multiple routers. .IP "\fB\-\-help\fR" 4 .IX Item "--help" Print a brief help message and exit. .IP "\fB\-\-man\fR" 4 .IX Item "--man" Prints the manual page and exits. .IP "\fB\-\-version\fR" 4 .IX Item "--version" Print the version of cfgmaker. This should match the version of \s-1MRTG\s0 for which config files are being created. .IP "\fB\-\-ifref\fR \fBnr\fR|\fBip\fR|\fBeth\fR|\fBdescr\fR|\fBname\fR" 4 .IX Item "--ifref nr|ip|eth|descr|name" Select the interface identification method. Default is \fBnr\fR which identifies the router interfaces by their number. Unfortunately the interface numbering scheme in an \s-1SNMP\s0 tree can change. Some routers change their numbering when new interfaces are added, others change their numbering every full moon just for fun. .Sp To work around this sad problem \s-1MRTG\s0 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 addresses can be problematic as some routers have the same ethernet address on most of their interface cards. .Sp Select \fBip\fR to identify the interface by its \s-1IP\s0 number. Use \fBeth\fR to use the ethernet address for identification. Use \fBdescr\fR to use the Interface description. Or use \fBname\fR to use the Interface name. .Sp You can specify multiple properties if you wish, separated by commas. In this case, cfgmaker will use the first item in the list which can provide unique identification. This allows you to specify, for example, to use \s-1IP\s0 address and to use ifName if this is not defined: \-\-ifref ip,name .Sp If your chosen method does not allow unique interface identification on the device you are querying, \fBcfgmaker\fR will tell you about it. .IP "\fB\-\-ifdesc\fR \fBnr\fR|\fBip\fR|\fBeth\fR|\fBdescr\fR|\fBname\fR|\fBtype\fR|\fBalias\fR" 4 .IX Item "--ifdesc nr|ip|eth|descr|name|type|alias" Select what to use as the description of the interface. The description appears in the \f(CW\*(C`Title[]\*(C'\fR property for the target as well as the text header in the \s-1HTML\s0 code defined in the target's \f(CW\*(C`PageTop[]\*(C'\fR. Default is to use \&\fBnr\fR which is just the interface number which isn't always useful to the viewer of the graphs. .Sp There are 6 other properties which could be used. Use \fBip\fR if you want to use the interface's IP-address. Use \fBeth\fR if you want to use the interface's ethernet address. If you want a better description, you can use either \fBdescr\fR, \fBname\fR or \fBalias\fR. 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 \s-1IOS\s0 using \fBname\fR might result in \f(CW"S0"\fR being the interface description , \fBdescr\fR might result in \f(CW"Serial0"\fR and \fBalias\fR might result in \f(CW"Link to HQ"\fR (provided that is what is used as the interface's \f(CW\*(C`description\*(C'\fR in the router's configuration). .Sp Finally, if you want to describe the interface by it's Btype (i.e \f(CW"ethernetCSMA"\fR, \f(CW"propPointtoPoint"\fR etc) you can use \fBtype\fR. .Sp You can specify multiple properties if you wish, separated by commas. In this case, cfgmaker will use the first item in the list which is available for this interface. This allows you to specify, for example, to use any of the different aliases in order of preference. .IP "\fB\-\-if\-filter\fR '\fBfilter-expression\fR'" 4 .IX Item "--if-filter 'filter-expression'" First of all, this is under some development and is experimental. .Sp Use this if you want to have better control over what interfaces gets included into the configuration. The \fBfilter-expression\fR is evaluated as a piece of Perl code and is expected to return a truth value. If true, include the interface and if false, exclude the interface. .Sp For a further discussion on how these filters work, see the section \&\*(L"Details on Filters\*(R" below. .IP "\fB\-\-if\-template\fR \fBtemplate-file\fR" 4 .IX Item "--if-template template-file" First of all, this is under some development and is experimental. .Sp Use this if you want to control what the line for each target should look like in the configuration file. The contents of the file \fBtemplate-file\fR will be evaluated as a Perl program which generates the lines using certain variables for input and output. .Sp For a further discussion on how these templates work, see the section \&\*(L"Details on Templates\*(R" below. .IP "\fB\-\-host\-template\fR \fBtemplate-file\fR" 4 .IX Item "--host-template template-file" First of all, this is under some development and is experimental. .Sp Use this if you want to have some extra targets related to the host itself such as \s-1CPU\s0 utilization, ping response time to the host, number of busy modems etc. The contents of the file \fBtemplate-file\fR will be evaluated once per host as a Perl program which generates the lines using certain variables for input and output. .Sp For a further discussion on how these templates work, see the section \&\*(L"Details on Templates\*(R" below. .IP "\fB\-\-community\fR \fBcommunity-string\fR" 4 .IX Item "--community community-string" Use this to set the community for the routers following on the command line to \fBcommunity-string\fR. Individual routers might override this community string by using the syntax \fBcommunity\fR\fB@\fR\fBrouter\fR. .IP "\fB\-\-enable\-ipv6\fR" 4 .IX Item "--enable-ipv6" This option enables IPv6 support. It requires the appropriate perl modules; if they are not found then IPv6 is disabled (see the ipv6 documentation). .Sp cfgmaker will use IPv6 or IPv4 depending on the target. If the target is a numeric address, the protocol depends on the type of address. If the target is a hostname, cfgmaker will try to resolve the name first to an IPv6 address then to an IPv4 address. .Sp IPv6 numeric addresses must be specified between square braces. .Sp For example: .Sp .Vb 1 \& cfgmaker \-\-enable\-ipv6 [2001:760:4::1]:165:::2 .Ve .Sp If the target has both an IPv6 address and an IPv4 address with the same hostname, cfgmaker first queries the target using IPv6 and falls back to IPv4 if it fails. This is useful for targets which don't support \s-1SNMP\s0 over IPv6. .IP "\fB\-\-use\-16bit\fR" 4 .IX Item "--use-16bit" This option forces the use of 16bit \s-1SNMP\s0 request IDs. Some broken \s-1SNMP\s0 agents do not accept 32bit request IDs. Try to avoid this option as much as possible, complain to your agent vendor instead. .IP "\fB\-\-snmp\-options\fR :[\fBport\fR][:[\fBtimeout\fR][:[\fBretries\fR][:[\fBbackoff\fR][:\fBversion\fR]]]]" 4 .IX Item "--snmp-options :[port][:[timeout][:[retries][:[backoff][:version]]]]" Use this to set the default \s-1SNMP\s0 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 \fB\-\-snmp\-options\fR by using the syntax .Sp \&\fBrouter\fR[:[\fBport\fR][:[\fBtimeout\fR][:[\fBretries\fR][:[\fBbackoff\fR][:\fBversion\fR]]]]] .ie n .IP "\fB\-\-global\fR \fB""\fR\fIbla: abc\fR\fB""\fR" 4 .el .IP "\fB\-\-global\fR \fB``\fR\fIbla: abc\fR\fB''\fR" 4 .IX Item "--global ""bla: abc""" Use this to add global options to the generated config file. You can call \fB\-\-global\fR 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. .Sp .Vb 1 \& \-\-global "workdir: /home/mrtg" .Ve .Sp If you want some default Options you might want to put .Sp .Vb 1 \& \-\-global "options[_]: growright,bits" .Ve .Sp Specifying \fB\-\-global\fR after the last router on the command line will create a line in the configuration file which will appear after all the routers. .IP "\fB\-\-noreversedns\fR" 4 .IX Item "--noreversedns" Do not try to reverse lookup \s-1IP\s0 numbers ... a must for \s-1DNS\s0 free environments. .IP "\fB\-\-no\-down\fR" 4 .IX Item "--no-down" Normally cfgmaker will not include interfaces which are marked anything but administratively and operationally \s-1UP.\s0 With this switch you get them all. .IP "\fB\-\-show\-op\-down\fR" 4 .IX Item "--show-op-down" Include interfaces which are operatively down. .IP "\fB\-\-zero\-speed\fR \fIspeed\fR" 4 .IX Item "--zero-speed speed" Assign this speed in bits-per-second to all interfaces which return 0 for ifSpeed and ifHighSpeed. Some switches, notably Foundry equipment, return a speed of zero for some interfaces. For example, to have all interfaces reporting zero set to 100Mbps, use \&\-\-zero\-speed=100000000. .IP "\fB\-\-subdirs\fR \fIformat\fR" 4 .IX Item "--subdirs format" Give each router its own subdirectory for the \s-1HTML\s0 and graphics (or \&.rrd) files. The directory name is the given \fIformat\fR string with a couple of pattern replacements. The string \*(L"\s-1HOSTNAME\*(R"\s0 will be replaced by the hostname of the router (however you specified it on the \fBcfgmaker\fR commandline \*(-- it may be an actual hostname or just an \&\s-1IP\s0 address), and \*(L"\s-1SNMPNAME\*(R"\s0 will be replaced with the device's idea of its own name (the same name that appears on the right side of the \&\*(L"Title\*(R" lines). For instance, a call like: .Sp .Vb 1 \& cfgmaker \-\-subdirs=HOSTNAME_\|_SNMPNAME public@10.10.0.18 .Ve .Sp would result in the generation of lines looking something like: .Sp .Vb 1 \& Directory[10.10.0.18_1]: 10.10.0.18_\|_fp2200\-bothrip\-1.3 .Ve .IP "\fB\-\-output\fR \fIfile\fR" 4 .IX Item "--output file" Write the output from \fBcfgmaker\fR into the file \fIfile\fR. The default is to use \f(CW\*(C`STDOUT\*(C'\fR. \fB\-\-output\fR is expected to appear only once on the command line. If used multiple times, the file specified by the last \&\fB\-\-output\fR will be used. .IP "\fB\-\-nointerfaces\fR" 4 .IX Item "--nointerfaces" Don't generate configuration lines for interfaces. .Sp This makes cfgmaker skip all steps related to interfaces which means it will not do any polling of the router to retrieve interface information which speeds up the execution of cfgmaker and it will neither run any interface templates. .IP "\fB\-\-interfaces\fR" 4 .IX Item "--interfaces" This makes cfgmaker generate configuration lines for interfaces (the default behaviour). .Sp The main usage of this option is to negate an \-\-nointerfaces appearing earlier on the command line. .SS "\s-1SNMP V3\s0 Options" .IX Subsection "SNMP V3 Options" \&\fBCfgmaker\fR supports \s-1SNMP V3\s0 using the \fBNet:SNMP\fR perl module. There are optional parameters affecting \s-1SNMP\s0 operation. .IP "\-\-enablesnmpv3 {yes|no}" 4 .IX Item "--enablesnmpv3 {yes|no}" The \fB\-\-enablesnmpv3\fR option is an optional flag to check for the presence of the \fBNet::SNMP\fR libraries. \fBCfgmaker\fR will try to determine whether this flag is required and will set the values automatically. .PP \fISNMPv3 Arguments\fR .IX Subsection "SNMPv3 Arguments" .PP A \s-1SNMP\s0 context is a collection of management information accessible by a \s-1SNMP\s0 entity. An item of management information may exist in more than one context and a \s-1SNMP\s0 entity potentially has access to many contexts. The combination of a contextEngineID and a contextName unambiguously identifies a context within an administrative domain. In a SNMPv3 message, the contextEngineID and contextName are included as part of the scopedPDU. All methods that generate a \s-1SNMP\s0 message optionally take a \fB\-\-contextengineid\fR and \fB\-\-contextname\fR argument to configure these fields. .IP "Context Engine \s-1ID\s0" 4 .IX Item "Context Engine ID" The \fB\-\-contextengineid\fR argument expects a hexadecimal string representing the desired contextEngineID. The string must be 10 to 64 characters (5 to 32 octets) long and can be prefixed with an optional \*(L"0x\*(R". Once the \&\fB\-\-contextengineid\fR is specified it stays with the object until it is changed again or reset to default by passing in the undefined value. By default, the contextEngineID is set to match the authoritativeEngineID of the authoritative \&\s-1SNMP\s0 engine. .IP "Context Name" 4 .IX Item "Context Name" The contextName is passed as a string which must be 0 to 32 octets in length using the \fB\-\-contextname\fR argument. The contextName stays with the object until it is changed. The contextName defaults to an empty string which represents the \*(L"default\*(R" context. .PP \fIUser-based Security Model Arguments\fR .IX Subsection "User-based Security Model Arguments" .PP The User-based Security Model (\s-1USM\s0) used by SNMPv3 requires that a securityName be specified using the \fB\-\-username\fR argument. The creation of a Net::SNMP object with the version set to SNMPv3 will fail if the \fB\-\-username\fR argument is not present. The \fB\-\-username\fR argument expects a string 1 to 32 octets in length. .PP Different levels of security are allowed by the User-based Security Model which address authentication and privacy concerns. A SNMPv3 target will derive the security level (securityLevel) based on which of the following arguments are specified. .PP By default a securityLevel of 'noAuthNoPriv' is assumed. If the \fB\-\-authkey\fR or \fB\-\-authpassword\fR arguments are specified, the securityLevel becomes \&'authNoPriv'. The \fB\-\-authpassword\fR argument expects a string which is at least 1 octet in length. Optionally, the \fB\-\-authkey\fR argument can be used so that a plain text password does not have to be specified in a script. The \&\fB\-\-authkey\fR argument expects a hexadecimal string produced by localizing the password with the authoritativeEngineID for the specific destination device. The \f(CW\*(C`snmpkey\*(C'\fR utility included with the Net::SNMP distribution can be used to create the hexadecimal string (see snmpkey). .PP Two different hash algorithms are defined by SNMPv3 which can be used by the Security Model for authentication. These algorithms are \s-1HMAC\-MD5\-96 \*(L"MD5\*(R"\s0 (\s-1RFC 1321\s0) and \s-1HMAC\-SHA\-96 \*(L"SHA\-1\*(R"\s0 (\s-1NIST FIPS PUB 180\-1\s0). The default algorithm used by the module is \s-1HMAC\-MD5\-96.\s0 This behavior can be changed by using the \fB\-\-authprotocol\fR argument. This argument expects either the string \&'md5' or 'sha' to be passed to modify the hash algorithm. .PP By specifying the arguments \fB\-\-privkey\fR or \fB\-\-privpassword\fR the securityLevel associated with the object becomes 'authPriv'. According to SNMPv3, privacy requires the use of authentication. Therefore, if either of these two arguments are present and the \fB\-\-authkey\fR or \fB\-\-authpassword\fR arguments are missing, the creation of the object fails. The \fB\-\-privkey\fR and \&\fB\-\-privpassword\fR arguments expect the same input as the \fB\-\-authkey\fR and \&\fB\-\-authpassword\fR arguments respectively. .PP The User-based Security Model described in \s-1RFC 3414\s0 defines a single encryption protocol to be used for privacy. This protocol, CBC-DES \*(L"\s-1DES\*(R"\s0 (\s-1NIST FIPS PUB 46\-1\s0), is used by default or if the string 'des' is passed to the \&\fB\-\-privprotocol\fR argument. By working with the Extended Security Options Consortium http://www.snmp.com/eso/, the module also supports additional protocols which have been defined in draft specifications. The draft http://www.snmp.com/eso/draft\-reeder\-snmpv3\-usm\-3desede\-00.txt defines the support of \s-1CBC\-3DES\-EDE\s0 \*(L"Triple-DES\*(R" (\s-1NIST FIPS 46\-3\s0) in the User-based Security Model. This protocol can be selected using the \&\fB\-\-privprotocol\fR argument with the string '3desede'. The draft http://www.snmp.com/eso/draft\-blumenthal\-aes\-usm\-04.txt describes the use of \s-1CFB128\-AES\-128/192/256 \*(L"AES\*(R"\s0 (\s-1NIST FIPS PUB 197\s0) in the \&\s-1USM.\s0 The three \s-1AES\s0 encryption protocols, differentiated by their key sizes, can be selected by passing 'aescfb128', 'aescfb192', or 'aescfb256' to the \&\fB\-privprotocol\fR argument. .SS "Details on Filters" .IX Subsection "Details on Filters" The purpose of the filters is to decide which interfaces to accept and which interfaces to reject. This decision is done for each interface by evaluating the filter expression as a piece of Perl code and investigating the result of the evaluation. If true, accept the interface otherwise reject it. .PP When working with filters, remember that Perl has it's own idea of what truth and false is. The empty string "\*(L" and the string \*(R"0" are false, all other strings are true. This further implies that any integer value of 0 is false as well as any undef value. It also implies that all references are considered true. .PP As the filter is evaluated as a Perl expression, several useful constructs in Perl are worth mentioning: .PP Expressions might be grouped by using parentheses \*(L"()\*(R". Expressions might be combined using boolean operators such as the following: .ie n .IP """\fBand\fR"" (equivalent with ""\fB&&\fR"")" 4 .el .IP "``\fBand\fR'' (equivalent with ``\fB&&\fR'')" 4 .IX Item """and (equivalent with &&"")" Boolean \*(L"and\*(R" of the two expressions, is only true if both expressions are true. Example: \fIexpression1\fR \fBand\fR \fIexpression2\fR .ie n .IP """\fBor\fR"" (equivalent with ""\fB||\fR"")" 4 .el .IP "``\fBor\fR'' (equivalent with ``\fB||\fR'')" 4 .IX Item """or (equivalent with ||"")" Boolean \*(L"or\*(R" of the two expressions, is true if either or both expressions are true. Example: \fIexpression1\fR \fBor\fR \fIexpression2\fR .ie n .IP """\fBnot\fR"" (equivalent with ""\fB!\fR"")" 4 .el .IP "``\fBnot\fR'' (equivalent with ``\fB!\fR'')" 4 .IX Item """not (equivalent with !"")" Boolean negation of a single expression. Example: \fBnot\fR \fIexpression\fR . Yet another example: \fB!\fR\fIexpression\fR .PP (For more details on this I recommend a book on Perl) .PP \fIPredefined Filter Variables\fR .IX Subsection "Predefined Filter Variables" .PP To facilitate, there are a number of predefined values available to use in the filter. Note that these variables are also available when templates interfaces are evaluated (but not host templates). .PP Caveat: All these variables' names begin with a dollar sign ($), which is a syntactic requirement for scalar variables in Perl. The danger here is that the dollar sign in many shells is an active character (often used for shell variables exactly as in Perl variables) so it is important to ensure that the Perl expression isn't evaluated by the command line shell as shell code before being passed to cfgmaker as command line arguments. In shells like Bourne shell, ksh shell or bash shell, placing the entire expression within single quotes will avoid such accidental evaluation: .PP .Vb 1 \& \*(Aq\-\-if\-filter=($default_iftype && $if_admin)\*(Aq .Ve .IP "\fB\f(CB$if_type\fB\fR" 4 .IX Item "$if_type" This is an integer specifying the interface type as per the \s-1SNMP\s0 standards and as reported by the polled device. A complete list of interface types would be impractical for this document , but there are a number predefined variables below. Normally, cfgmaker puts in the target's PageTop this iftype value within parenthesis after the name of the interface type. (e.g \*(L"propPointToPointSerial (22)\*(R"). .Sp Here's a list of some of the most common interface types by number: .Sp .Vb 10 \& 6 ethernetCsmacd \& 7 iso88023Csmacd \& 9 iso88025TokenRing \& 15 fddi \& 19 E1 \& 20 basicISDN \& 21 primaryISDN \& 22 propPointToPointSerial \& 23 ppp \& 24 softwareLoopback \& 30 ds3 \& 32 frame\-relay \& 33 rs232 \& 37 atm \& 39 sonet \& 44 frameRelayService \& 46 hssi \& 49 aal5 \& 53 propVirtual \& 62 Fast Ethernet (100BaseT) \& 63 ISDN & X.25 \& 69 Full Duplex Fast Ethernet (100BaseFX) \& 94 Asymmetric Digital Subscriber Loop (ADSL) \& 117 Gigabit Ethernet \& 134 ATM Sub Interface .Ve .IP "\fB\f(CB$default\fB\fR" 4 .IX Item "$default" True if and only if cfgmaker normally should accepted the interface based on the interfaces administrative and operational state (taking the flags \fB\-\-no\-down\fR and \fB\-\-show\-op\-down\fR into account) and it's type (and a few other things). .IP "\fB\f(CB$default_ifstate\fB\fR" 4 .IX Item "$default_ifstate" True if and only if cfgmaker would have accepted the interface based on it's operational and administrative states (also taking into account the presence of the flags \fB\-\-no\-down\fR and \fB\-\-show\-op\-down\fR). .IP "\fB\f(CB$default_iftype\fB\fR" 4 .IX Item "$default_iftype" True if and only if cfgmaker would have accepted the interface based on it's type (and a few type specific details in addition). .IP "\fB\f(CB$if_admin\fB\fR" 4 .IX Item "$if_admin" True if and only if the interface is in an administrative up state. .IP "\fB\f(CB$if_oper\fB\fR" 4 .IX Item "$if_oper" True if and only if the interface is in an operational up state. .PP A number of variables are also predefined to easily decide if an interface belong to a certain category or not. Below is all those variables listed together with which if_type numbers each variable will be true for. Note that some variables refer to other variables as well. .IP "\fB\f(CB$if_is_ethernet\fB\fR" 4 .IX Item "$if_is_ethernet" True for ethernet interfaces (nr 6, 7, 26, 62, 69 and 117). .IP "\fB\f(CB$if_is_isdn\fB\fR" 4 .IX Item "$if_is_isdn" True for various \s-1ISDN\s0 interface types (nr 20, 21, 63, 75, 76 and 77) .IP "\fB\f(CB$if_is_dialup\fB\fR" 4 .IX Item "$if_is_dialup" True for dial-up interfaces such as \s-1PPP\s0 as well as \s-1ISDN.\s0 (nr 23, 81, 82 and 108 in addition to the numbers of \&\fB\f(CB$if_is_isdn\fB\fR). .IP "\fB\f(CB$if_is_atm\fB\fR" 4 .IX Item "$if_is_atm" True for miscellaneous \s-1ATM\s0 related interface types (nr 37, 49, 107, 105, 106, 114 and 134). .IP "\fB\f(CB$if_is_wan\fB\fR" 4 .IX Item "$if_is_wan" True for \s-1WAN\s0 interfaces point to point, Frame Relay and High Speed Serial ( 22,32,44,46) .IP "\fB\f(CB$if_is_lan\fB\fR" 4 .IX Item "$if_is_lan" True for \s-1LAN\s0 interfaces (8, 9, 11, 15, 26, 55, 59, 60 and 115 in addition to the numbers of \fB\f(CB$if_is_ethernet\fB\fR). .IP "\fB\f(CB$if_is_dsl\fB\fR" 4 .IX Item "$if_is_dsl" True for \s-1ADSL, RDSL, HDSL\s0 and \s-1SDSL\s0 (nr 94, 95, 96, 97) .IP "\fB\f(CB$if_is_loopback\fB\fR" 4 .IX Item "$if_is_loopback" True for software loopback interfaces (nr 24) .IP "\fB\f(CB$if_is_ciscovlan\fB\fR" 4 .IX Item "$if_is_ciscovlan" True for Cisco \s-1VLAN\s0 interfaces (interfaces with the word Vlan or \s-1VLAN\s0 in their ifdescs) .IP "\fB\f(CB$if_vlan_id\fB\fR" 4 .IX Item "$if_vlan_id" Returns the vlan id associated with a specific port on Cisco Catalyst switches under both Catalyst \s-1OS\s0 and \s-1IOS,\s0 and 3Com switches. If it is not a vlan interface, will return undef. .IP "\fB\f(CB$if_cisco_trunk\fB\fR" 4 .IX Item "$if_cisco_trunk" Returns the trunking state of a specific port on Cisco Catalyst switches under both Catalyst \s-1OS\s0 and \s-1IOS.\s0 Returns \*(L"1\*(R" if the interface is a trunk, undef otherwise. .IP "\fB\f(CB$if_MTU\fB\fR" 4 .IX Item "$if_MTU" Returns the Maximum Transfer Unit associated with a specific port. .PP Besides that, you can also use the variables defined for templates below. Further, all the variables available in cfgmaker is at the scripts disposal even if the use of such features is discouraged. More \*(L"shortcuts\*(R" in the form of variables and functions will be made available in the future instead. .PP \fIExamples on Filters\fR .IX Subsection "Examples on Filters" .PP The following filter will not affect which interfaces gets included or excluded, it will make cfgmaker behave as normally. .PP .Vb 1 \& \*(Aq\-\-if\-filter=$default\*(Aq .Ve .PP The following filter will make cfgmaker exclude \s-1PPP\s0 (23) interfaces: .PP .Vb 1 \& \*(Aq\-\-if\-filter=$default && $if_type!=23\*(Aq .Ve .PP The following filter will make cfgmaker behave as usual except that it will consider the operational state of an interface irrelevant but still reject all interfaces which are administratively down. .PP .Vb 1 \& \*(Aq\-\-if\-filter=$if_admin && $default_iftype\*(Aq .Ve .SS "Details on Templates" .IX Subsection "Details on Templates" The contents of the template files are evaluated as a Perl program. A number or Perl variables are available for the program to read and others are used to be written to. .PP As quite a few of the predefined variables has values which are are supposed to be used in \s-1HTML\s0 code some of them have an \*(L"HTML-escaped\*(R" variant, e.g \&\f(CW$html_syslocation\fR is the \s-1HTML\s0 escaped variant of \f(CW$syslocation\fR. The \s-1HTML\s0 escaping means that the chars \*(L"<\*(R", \*(L">\*(R" and \*(L"&\*(R" are replaced by \*(L"<\*(R", \&\*(L">\*(R" and \*(L"&\*(R" and that newlines embedded in the string are prepended with \*(L"<\s-1BR\s0>\*(R" and appended with a space character (if a newline is last in the string it is not touched). .PP \fIWritable Template Variables\fR .IX Subsection "Writable Template Variables" .PP These are the variables available to store the configuration lines in. Some of them are initialized prior to the evaluation of the template but such content normally is comments for inclusion in the final configuration file so those variables might be reset to the empty string in the template code to eliminate the comments. The other way around is also possible, the contents of these variables might be extended with further information for various reasons such as debugging etc. .PP Once the template has been evaluated, the following happens: if the template is a interface template and the actual interface for some reason is rejected and thus needs to be commented out, all the lines in the variable \fB\f(CB$target_lines\fB\fR are turned into comments by adding a hash mark (\*(L"#\*(R") at their beginning. Then all the variables \fB\f(CB$head_lines\fB\fR, \&\fB\f(CB$problem_lines\fB\fR , \fB\f(CB$target_lines\fB\fR and \fB\f(CB$separator_lines\fB\fR are concatenated together to form the lines to add to the configuration file. .IP "\fB\f(CB$target_lines\fB\fR" 4 .IX Item "$target_lines" This variable is the placeholder for the configuration lines created by the template. \fB\f(CB$target_lines\fB\fR is predefined to be empty when the template code is evaluated. .IP "\fB\f(CB$head_lines\fB\fR" 4 .IX Item "$head_lines" This variable is intended to be the placeholder for the comment line appearing just before the target in the configuration file. It is initialized with that comment line before the evaluation of the template code and if the template doesn't modify \fB\f(CB$head_lines\fB\fR during evaluation, the comment will look like usual in the config file. .IP "\fB\f(CB$problem_lines\fB\fR" 4 .IX Item "$problem_lines" This variable is intended to be the placholder for the comment lines describing any problems which might have been encountered when trying to add the target into the configuration. For host templates it's normally not used and for those it's predefined as the empty string. For interface templates \fB\f(CB$problem_lines\fB\fR is predefined with the error description comments which cfgmaker normally would use for rejected interfaces or as the empty string for accepted interfaces. .Sp It is possible to test against \fB\f(CB$problem_lines\fB\fR to find out if an interface will be included or rejected but this is not recommended. Test against \fB\f(CB$if_ok\fB\fR instead. .IP "\fB\f(CB$separator_lines\fB\fR" 4 .IX Item "$separator_lines" This variable is the placeholder for the string to use as the separator between the code for individual targets. The contents of this variable is put after each target (so the lines will appear after the end of the last target in the config as well). .PP \fIPredefined Template Variables\fR .IX Subsection "Predefined Template Variables" .PP All the variables below are available for interface templates to use. For host templates, only those listed under \*(L"Host and System Variables\*(R" are available. .PP For interface templates the variables listed under \&\*(L"Predefined Filter Variables\*(R" are also available. .PP \fIHost and System Variables\fR .IX Subsection "Host and System Variables" .IP "\fB\f(CB$router_name\fB\fR" 4 .IX Item "$router_name" This is the fully qualified name for the router. It is affected by the following items on the command line: the router name itself and \&\fB\-\-dns\-domain\fR. .IP "\fB\f(CB$router_connect\fB\fR" 4 .IX Item "$router_connect" This is the reference string for the router being polled. It is on the form community@router possibly followed by some snmp options. It is affected by the following items on the command line: the router name itself, \fB\-\-community\fR, \fB\-\-snmp\-options\fR and \fB\-\-dns\-domain\fR. (There's no \s-1HTML\s0 escaped variant available) .IP "\fB\f(CB$directory_name\fB\fR" 4 .IX Item "$directory_name" This variable should contain the directory name as cfgmaker normally would use as the value for the \*(L"Directory[]\*(R" directive. The value is determined by the \fB\-\-subdirs\fR command line option. If \fB\-\-subdirs\fR isn't specified \&\fB\f(CB$directory_name\fB\fR will be the empty string. (There's no \s-1HTML\s0 escaped variant available) .IP "\fB\f(CB$syscontact\fB\fR" 4 .IX Item "$syscontact" This variable is the router's \s-1SNMP\s0 sysContact value. (\s-1HTML\s0 escaped variant: \fB\f(CB$html_syscontact\fB\fR) .IP "\fB\f(CB$sysname\fB\fR" 4 .IX Item "$sysname" This variable is the router's \s-1SNMP\s0 sysName value. (No \s-1HTML\s0 escaped variant available) .IP "\fB\f(CB$syslocation\fB\fR" 4 .IX Item "$syslocation" This variable is the router's \s-1SNMP\s0 sysLocation value. (\s-1HTML\s0 escaped variant: \fB\f(CB$html_syslocation\fB\fR) .IP "\fB\f(CB$sysdescr\fB\fR" 4 .IX Item "$sysdescr" This variable is the router's \s-1SNMP\s0 sysDescr value. It is normally not used by cfgmaker but might be useful in a template. (\s-1HTML\s0 escaped variant: \&\fB\f(CB$html_sysdescr\fB\fR) .PP \fIInterface Target Related Variables\fR .IX Subsection "Interface Target Related Variables" .IP "\fB\f(CB$target_name\fB\fR" 4 .IX Item "$target_name" This is what cfgmaker normally would use as the the name of the target. The target name is what is found within the square brackets, \*(L"[]\*(R", for target directives. (There's no \s-1HTML\s0 escaped variant available) .IP "\fB\f(CB$if_ref\fB\fR" 4 .IX Item "$if_ref" This the reference string for the interface. It is expected to be used in the \*(L"Target[xyz]\*(R" directive to distinguish what interface to use. The value of this variable is affected by the \fB\-\-ifref\fR command line option. It is normally used together with \fB\f(CB$router_connect\fB\fR. (There's no \s-1HTML\s0 escaped variant available) .IP "\fB\f(CB$if_ok\fB\fR" 4 .IX Item "$if_ok" This variable is true if the interface is going to be included into the configuration file, otherwise false. Don't test against other variables such as \fB\f(CB$problem_lines\fB\fR to find out if an interface will be rejected or not, use this \fB\f(CB$if_ok\fB\fR instead. .IP "\fB\f(CB$default_target_lines\fB\fR" 4 .IX Item "$default_target_lines" This variable contains all the target lines which cfgmaker by default outputs for this interface. It's useful if you want to have the \*(L"standard target\*(R" but want to add some extra lines to it by using a template. .PP By default cfgmaker uses the following directives for each target it generates: Target[], SetEnv[], MaxBytes[], Title[], PageTop[] and if there is any directory specified also the Directory[] directive. .PP To facilitate the creation of templates which generates target configs which are similar to the default one, each of the above mentioned directive lines have a corresponding variable containing the line as cfgmaker would have output it by default. .PP Note that none of these have a \s-1HTML\s0 escaped variant, text in them is \&\s-1HTML\s0 escaped where needed. Also note that they do not have any newline at the end. .IP "\fB\f(CB$default_target_directive\fB\fR" 4 .IX Item "$default_target_directive" This variable contains the default string for the Target[] directive line. .IP "\fB\f(CB$default_setenv_directive\fB\fR" 4 .IX Item "$default_setenv_directive" This variable contains the default string for the SetEnv[] directive line. .IP "\fB\f(CB$default_directory_directive\fB\fR" 4 .IX Item "$default_directory_directive" This variable contains the default string for the Directory[] directive line which means it is an empty string (with no newline) if there's no directory. .IP "\fB\f(CB$default_maxbytes_directive\fB\fR" 4 .IX Item "$default_maxbytes_directive" This variable contains the default string for the MaxBytes[] directive line. .IP "\fB\f(CB$default_title_directive\fB\fR" 4 .IX Item "$default_title_directive" This variable contains the default string for the Title[] directive line. .IP "\fB\f(CB$default_pagetop_directive\fB\fR" 4 .IX Item "$default_pagetop_directive" This variable contains the default string for the PageTop[] directive lines. .PP \fIInterface Network Configuration Variables\fR .IX Subsection "Interface Network Configuration Variables" .IP "\fB\f(CB$if_ip\fB\fR" 4 .IX Item "$if_ip" This variable should contain the IP-address of the interface, if any has been assigned to it. (There's no \s-1HTML\s0 escaped variant available) .IP "\fB\f(CB$ifindex\fB\fR" 4 .IX Item "$ifindex" This variable is the \s-1SNMP\s0 ifIndex for the interface which per definition always is an integer. (There's no \s-1HTML\s0 escaped variant available) .IP "\fB\f(CB$if_index\fB\fR" 4 .IX Item "$if_index" Equivalent with \fB\f(CB$ifindex\fB\fR. .IP "\fB\f(CB$if_eth\fB\fR" 4 .IX Item "$if_eth" Contains the ethernet address of the interface, if any. (There's no \s-1HTML\s0 escaped variant available) .IP "\fB\f(CB$if_speed\fB\fR" 4 .IX Item "$if_speed" This variable is the speed in bytes/second (with prefixes). (There's no \&\s-1HTML\s0 escaped variant available) .IP "\fB\f(CB$if_speed_str\fB\fR" 4 .IX Item "$if_speed_str" This variable is a cooked speed description which is either in bits or bytes depending on whether or not the bits option is active and also with the proper prefix for the speed (k, M, G etc). (No \s-1HTML\s0 escaped variant available) .IP "\fB\f(CB$if_type_desc\fB\fR" 4 .IX Item "$if_type_desc" This variable is a textual description of the interface type. (\s-1HTML\s0 escaped variant: \fB\f(CB$html_if_type_desc\fB\fR) .IP "\fB\f(CB$if_type_num\fB\fR" 4 .IX Item "$if_type_num" This variable the integer value corresponding to the interface type (for a listing for the value for the more common interface types, see the section \&\s-1DETAILS ON FILTERS\s0 above). (No \s-1HTML\s0 escaped variant available) .IP "\fB\f(CB$if_dns_name\fB\fR" 4 .IX Item "$if_dns_name" This is the \s-1DNS\s0 name for the interface. (No \s-1HTML\s0 escaped variant available) .PP \fIInterface Name, Description and Alias Variables\fR .IX Subsection "Interface Name, Description and Alias Variables" .PP It might seem confusing with both \fIName\fR, \fIDescription\fR and \fIAlias\fR in this context and to some extent it is. \fIName\fR and \fIDescription\fR are usually supported on most equipment but how they are used varies, both between manufacturers as well as between different categories of equipment from the same manufacturer. The \fIAlias\fR is at least supported by Cisco \&\s-1IOS,\s0 and that variable contains whatever is used in the \s-1IOS\s0 statement called \*(L"description\*(R" for the interface (not to be confused with the \s-1SNMP\s0 variables for \fIDescription\fR). .PP For better control from the command line consider \fB\f(CB$if_title_desc\fB\fR which contents are controlled by the \fB\-\-if\-descr\fR command line option. .IP "\fB\f(CB$if_snmp_descr\fB\fR" 4 .IX Item "$if_snmp_descr" This variable should contain the \*(L"raw\*(R" description of the interface as determined by the \s-1SNMP\s0 polling of the router. (\s-1HTML\s0 escaped variant: \&\fB\f(CB$html_if_snmp_descr\fB\fR) .IP "\fB\f(CB$if_snmp_name\fB\fR" 4 .IX Item "$if_snmp_name" The \*(L"raw\*(R" name for the interface as provided by \s-1SNMP\s0 polling. (\s-1HTML\s0 escaped variant: \fB\f(CB$html_if_snmp_name\fB\fR) .IP "\fB\f(CB$if_snmp_alias\fB\fR" 4 .IX Item "$if_snmp_alias" The \*(L"raw\*(R" ifAlias for the interface as provided by \s-1SNMP\s0 polling. (\s-1HTML\s0 escaped variant: \fB\f(CB$html_if_snmp_alias\fB\fR) .IP "\fB\f(CB$if_cisco_descr\fB\fR" 4 .IX Item "$if_cisco_descr" The \*(L"raw\*(R" CiscolocIfDescr for the interface as provided by \s-1SNMP\s0 polling. (\s-1HTML\s0 escaped variant: \fB\f(CB$html_if_cisco_descr\fB\fR) .IP "\fB\f(CB$if_description\fB\fR" 4 .IX Item "$if_description" This is the \*(L"cooked\*(R" description string for the interface, taking into account the \s-1SNMP\s0 values found for the interface's RDescr, ifAlias and CiscolocIfDescr. (\s-1HTML\s0 escaped variant: \fB\f(CB$html_if_description\fB\fR) .IP "\fB\f(CB$if_title\fB\fR" 4 .IX Item "$if_title" The full string cfgmaker by default would have used for the Title[] directive in the configuration as well as the content of the topmost H1 tag in the PageTop[]. Is composed by the contents of \fB\f(CB$desc_prefix\fB\fR, \&\fB\f(CB$if_title_desc\fB\fR and \fB\f(CB$sysname\fB\fR. .Sp As \fB\f(CB$if_title\fB\fR depends on \fB\f(CB$if_title_desc\fB\fR, it is possible to indirectly control \fB\f(CB$if_title\fB\fR by using the command line option \fB\-\-if\-descr\fR. .Sp (\s-1HTML\s0 escaped variant: \fB\f(CB$html_if_title\fB\fR) .IP "\fB\f(CB$if_port_name\fB\fR" 4 .IX Item "$if_port_name" If the host is a Cisco Catalyst \s-1LAN\s0 switch, this variable is the name of that port. (No \s-1HTML\s0 escaped variant available) .IP "\fB\f(CB$if_pp_port_name\fB\fR" 4 .IX Item "$if_pp_port_name" If the host is a Nortel Passport \s-1LAN\s0 switch, this variable is the name of that port. (No \s-1HTML\s0 escaped variant available) .IP "\fB\f(CB$desc_prefix\fB\fR" 4 .IX Item "$desc_prefix" This variable is a prefix of the description of what the target is to use in the \*(L"Title[]\*(R" directive and in the H1 section of the \*(L"PageTop[]\*(R". Default is \&\*(L"Traffic analysis for \*(R". (\s-1HTML\s0 escaped variant: \fB\f(CB$html_desc_prefix\fB\fR) .IP "\fB\f(CB$if_title_desc\fB\fR" 4 .IX Item "$if_title_desc" This is the description of the interface normally used by cfgmaker as part of the variable \fB\f(CB$if_title\fB\fR. The latter is used as the full string in the \&\*(L"Title[]\*(R" directive and the H1 section in the PageTop[]. .Sp \&\fB\f(CB$if_title_desc\fB\fR is controlled by the command line option \fB\-\-if\-descr\fR which indirectly controls the contents of \fB\f(CB$if_title\fB\fR .Sp (\s-1HTML\s0 escaped variant: \fB\f(CB$html_if_title_desc\fB\fR) .PP \fIHelp Functions for Templates\fR .IX Subsection "Help Functions for Templates" .PP The following functions exists to facilitate the writing of host and interface templates. .IP "\fBhtml_escape(\f(BIstring\fB)\fR" 4 .IX Item "html_escape(string)" \&\fB\fBhtml_escape()\fB\fR takes a string as an argument and returns a new string where the following substitutions has been done: the chars \*(L"<\*(R", \*(L">\*(R" and \&\*(L"&\*(R" are replaced by \*(L"<\*(R", \*(L">\*(R" and \*(L"&\*(R" and that newlines embedded in the string are prepended with \*(L"<\s-1BR\s0>\*(R" and appended with a space character (newlines at the end of the string are not touched). .ie n .IP "\fBoid_pick($router_connect,$v3opt,""oid1"",""oid2""...)\fR" 4 .el .IP "\fBoid_pick($router_connect,$v3opt,``oid1'',``oid2''...)\fR" 4 .IX Item "oid_pick($router_connect,$v3opt,oid1,oid2...)" This function will try to poll each of the oids specified until it is successful or has run out of oids. It will return the name of the first oid that worked or undef if it is not successful .PP \fIExample Template Files\fR .IX Subsection "Example Template Files" .PP Template Example 1: Eliminating Rejected Targets From Appearing .IX Subsection "Template Example 1: Eliminating Rejected Targets From Appearing" .PP This template file generates exactly the same configuration code per interface as cfgmaker does by default, with the exception that it eliminates all lines (comments as well as config code) for an interface if the interface happens to be rejected. .PP .Vb 3 \& if(not $problem_lines) \& { \& $target_lines .= <$html_desc_prefix$html_if_title_desc \-\- $sysname \&
\& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& ECHO \& \& $target_lines .= < \& \& \& \& ECHO \& \& $target_lines .= < \& \& \& \& ECHO \& \& $target_lines .= < \& \& \& \& ECHO \& \& $target_lines .= < \& \& \& \& ECHO \& \& $target_lines .= < \& \& ECHO \& } else { \& $head_lines=""; \& $problem_lines=""; \& $target_lines=""; \& $separator_lines=""; \& } .Ve .PP \fITemplate Example 2: Simpler Version of Example 1\fR .IX Subsection "Template Example 2: Simpler Version of Example 1" .PP Example 1 was partly intended to demonstrate how to customize the generation of interface targets but also to provide a hint of how the variables are used in the \*(L"default\*(R" template which one could consider that cfgmaker normally uses. .PP If you're only interested in the easiest way of entirely eliminating those reject interfaces, the template below would do the job as well by using \&\fB\f(CB$default_target_lines\fB\fR. .PP .Vb 8 \& if($if_ok) { \& $target_lines = $default_target_lines; \& } else { \& $head_lines=""; \& $problem_lines=""; \& $target_lines=""; \& $separator_lines=""; \& } .Ve .PP \fITemplate Example 3: Creating \s-1CPU\s0 Targets for Hosts\fR .IX Subsection "Template Example 3: Creating CPU Targets for Hosts" .PP Below is an example of a host template. .PP .Vb 3 \& $head_lines .= <$router_name CPU load \&
\&
System:$sysname in $html_syslocation
Maintainer:$html_syscontact
Description:$html_if_description
ifType:$html_if_type_desc ($if_type_num)
ifName:$html_if_snmp_name
Port Name:$if_port_name
Port Name:$if_pp_port_name
Max Speed:$if_speed_str
Ip:$if_ip ($if_dns_name)
\& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \& \&
System:$router_name in $html_syslocation
Maintainer:$html_syscontact
Description:$html_sysdescr
Resource:CPU.
\&
\& ECHO .Ve .SH "EXAMPLES" .IX Header "EXAMPLES" The first example creates a config file for \fIrouter.place.xyz\fR: the router has the community name \fIpublic\fR. Interfaces get identified by their \&\s-1IP\s0 number. Two global options get added to the config file. The config file gets redirected to \fImrtg.conf\fR. The '\e' signs at the end of the line mean that this command should be written on a single line. .PP .Vb 4 \& cfgmaker \-\-global "WorkDir: /home/tobi" \e \& \-\-global "Options[_]: growright,bits" \e \& \-\-ifref=ip \e \& public@router.place.xyz > mrtg.cfg .Ve .PP Note: if cfgmaker is not in your path, but you are in the directory where cfgmaker is stored, you can start it with ./cfgmaker .PP The next example creates a config file for four devices: \&\fIrouter1.place.xyz\fR, \fIrouter2.place.xyz\fR, \fIswitch1.place.xyz\fR and \&\fIswitch2.place.xyz\fR all with the community \fIpublic\fR. .PP The two routers will have \fB\-\-ifref\fR set to \fBdescr\fR whilst the two switches will use \fB\-\-ifref\fR set to \fBname\fR. Further the routers will use \fB\-\-ifdesc\fR set to \fBalias\fR and \fIswitch1.place.xyz\fR will use \&\fB\-\-ifdesc\fR set to \fBdescr\fR whilst \fIswitch2.place.xyz\fR use \fBname\fR instead. .PP 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. .PP .Vb 12 \& cfgmaker \-\-global "WorkDir: /home/tobi" \e \& \-\-global "Options[_]: growright,bits" \e \& \-\-ifref=descr \e \& \-\-ifdesc=alias \e \& public@router1.place.xyz \e \& public@router2.place.xyz \e \& \-\-global "Options[_]: growright" \e \& \-\-ifref=name \e \& \-\-ifdesc=descr \e \& public@switch1.place.xyz \e \& \-\-ifdesc=name \e \& public@switch2.place.xyz > mrtg.cfg .Ve .PP The next example demonstrates how to use the \fB\-\-community\fR, \&\fB\-\-snmp\-options\fR and \fB\-\-dns\-domain\fR to make the command line simpler. All the equipment will use the community \fIhidden\fR, except for the ppp-server which use community \fIaccess\fR. All equipment uses these \&\s-1SNMP\s0 options: \fB1s timeout\fR, \fB1 retry\fR and \fB\s-1SNMP\s0 version 2\fR (\fBbackoff\fR and \&\fBport\fR is unspecified which means they use the default values). The exception again is the ppp-server which uses \fB\s-1SNMP\s0 version 1\fR. Finally, all the equipment is part of the domain \fIplace.xyz\fR, except for the ppp-server which is part of the domain \fIremote.place.xyz\fR. Note that the latter is achieved simply by specifying the name of the ppp-server to be \fIppp-server.\f(BIremote\fI\fR . .PP .Vb 10 \& cfgmaker \-\-global "WorkDir: /home/tobi" \e \& \-\-global "Options[_]: growright,bits" \e \& \-\-dns\-domain=place.xyz \e \& \-\-community=hidden \e \& \-\-snmp\-options=::1:1::2 \e \& router1 \e \& router2 \e \& router3 \e \& router4 \e \& router5 \e \& switch1 \e \& switch2 \e \& switch3 \e \& switch4 \e \& switch5 \e \& switch6 \e \& switch7 \e \& access@ppp\-server.remote:::::1 > mrtg.cfg .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" mrtg-reference .SH "AUTHOR" .IX Header "AUTHOR" Tobias Oetiker and Jakob Ilves .SH "LICENSE" .IX Header "LICENSE" \&\s-1GNU\s0 General Public License .SH "COPYRIGHT" .IX Header "COPYRIGHT" Cfgmaker is Copyright 2000 by Tobias Oetiker