cfgmaker.1
上传用户:shbosideng
上传日期:2013-05-04
资源大小:1555k
文件大小:58k
- ." Automatically generated by Pod::Man v1.37, Pod::Parser v1.14
- ."
- ." Standard preamble:
- ." ========================================================================
- .de Sh " Subsection heading
- .br
- .if t .Sp
- .ne 5
- .PP
- fB\$1fR
- .PP
- ..
- .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. | will give a
- ." real vertical bar. *(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-|(bv*(Tr
- .ds C+ Cv'-.1v'h'-1p's-2+h'-1p'+s0v'.1v'h'-1p'
- .ie n {
- . ds -- (*W-
- . ds PI pi
- . if (n(.H=4u)&(1m=24u) .ds -- (*Wh'-12u'(*Wh'-12u'-" diablo 10 pitch
- . if (n(.H=4u)&(1m=20u) .ds -- (*Wh'-12u'(*Wh'-8u'-" diablo 12 pitch
- . ds L" ""
- . ds R" ""
- . ds C` ""
- . ds C' ""
- 'br}
- .el{
- . ds -- |(em|
- . ds PI (*p
- . ds L" ``
- . ds R" ''
- 'br}
- ."
- ." If the F register is turned on, we'll generate index entries on stderr for
- ." titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
- ." entries marked with X<> in POD. Of course, you'll have to process the
- ." output yourself in some meaningful fashion.
- .if nF {
- . de IX
- . tm Index:\$1t\n%t"\$2"
- ..
- . nr % 0
- . rr F
- .}
- ."
- ." For nroff, turn off justification. Always turn off hyphenation; it makes
- ." way too many mistakes in technical documents.
- .hy 0
- .if n .na
- ."
- ." 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(slh'|\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'(*bh'-*(#H'
- .ds o \k:h'-(\n(.wu+w'(de'u-*(#H)/2u'v'-.3n'*(#[z(dev'.3n'h'|\n:u'*(#]
- .ds d- h'*(#H'(pdh'-w'~'u'v'-.25m'f2(hyfPv'.25m'h'-*(#H'
- .ds D- D\k:h'-w'D'u'v'-.11m'z(hyv'.11m'h'|\n:u'
- .ds th *(#[v'.3m's+1Is-1v'-.3m'h'-(w'I'u*2/3)'s-1os+1*(#]
- .ds Th *(#[s+2Is-2h'-w'I'u*3/5'v'-.3m'ov'.3m'*(#]
- .ds ae ah'-(w'a'u*4/10)'e
- .ds Ae Ah'-(w'A'u*4/10)'E
- . " corrections for vroff
- .if v .ds ~ \k:h'-(\n(.wu*9/10-*(#H)'s-2u~ds+2h'|\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- dh'-1'(ga
- . ds D- Dh'-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 "2006-02-03" "2.13.2" "mrtg"
- .SH "NAME"
- cfgmaker - Creates mrtg.cfg files (for mrtg-2.13.2)
- .SH "SYNOPSIS"
- .IX Header "SYNOPSIS"
- cfgmaker [options] [community@]router [[options] [community@]router ...]
- .SH "OPTIONS"
- .IX Header "OPTIONS"
- .Vb 6
- & --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
- .Ve
- .PP
- .Vb 8
- & --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=alias ... uses Interface Alias
- & --ifdesc=type ... uses Interface Type
- .Ve
- .PP
- .Vb 6
- & --if-filter=f Test every interface against filter f to decide wether
- & or not to include that interface into the collection.
- & Currently f is being evaluated as a Perl expression
- & and it's truth value is used to reject or accept the
- & interface.
- & (Experimental, under development, might change)
- .Ve
- .PP
- .Vb 7
- & --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)
- .Ve
- .PP
- .Vb 9
- & --host-template=templatefile
- & In addition to creating targets for a host's 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)
- .Ve
- .PP
- .Vb 1
- & --global "x: a" add global config entries
- .Ve
- .PP
- .Vb 1
- & --no-down do not look at admin or opr status of interfaces
- .Ve
- .PP
- .Vb 1
- & --show-op-down show interfaces which are operatively down
- .Ve
- .PP
- .Vb 3
- & --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
- .Ve
- .PP
- .Vb 4
- & --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)"
- .Ve
- .PP
- .Vb 1
- & --noreversedns do not reverse lookup ip numbers
- .Ve
- .PP
- .Vb 2
- & --community=cmty Set the default community string to "cmty" instead of
- & "public".
- .Ve
- .PP
- .Vb 3
- & --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
- .Ve
- .PP
- .Vb 1
- & --use-16bit Use 16bit SNMP request IDs to query all routers.
- .Ve
- .PP
- .Vb 1
- & --snmp-options=:[<port>][:[<tmout>][:[<retr>][:[<backoff>][:<ver>]]]]
- .Ve
- .PP
- .Vb 4
- & 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.
- .Ve
- .PP
- .Vb 3
- & --dns-domain=domain
- & Specifies a domain to append to the name of all
- & routers following.
- .Ve
- .PP
- .Vb 3
- & --nointerfaces Don't do generate any configuration lines for interfaces,
- & skip the step of gathering interface information and
- & don't run any interface template code.
- .Ve
- .PP
- .Vb 3
- & --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.
- .Ve
- .PP
- .Vb 3
- & --help brief help message
- & --man full documentation
- & --version print the version of cfgmaker
- .Ve
- .PP
- .Vb 1
- & --output=file output filename default is STDOUT
- .Ve
- .SH "DESCRIPTION"
- .IX Header "DESCRIPTION"
- &fBCfgmakerfR creates s-1MRTGs0 configuration files based on information
- pulled from a router or another s-1SNMPs0 manageable device.
- .PP
- [fIcommunityfRfB@fR]fIrouterfR
- .PP
- &fICommunityfR is the community name of the device you want to create a
- configuration for. If not specified, it defaults to 'fBpublicfR'; 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
- &fIRouterfR is the s-1DNSs0 name or the s-1IPs0 number of an SNMP-managable device.
- Following the name you can specify 6 further options separated by
- colons. The full syntax looks like this:
- .PP
- &fBrouterfR[:[fBprtfR][:[fBtmoutfR][:[fBretrfR][:[fBbackofffR][:fBversfR]]]]]
- .PP
- Of special interest may be the last parameter, fBversfR. If you set this to
- &'2' then your device will be queried with s-1SNMPs0 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.
- .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.
- .Sh "Configuration"
- .IX Subsection "Configuration"
- Except for the fB--outputfR and fB--globalfR 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--outputfR and fB--globalfR for how their behaviour is affected by
- where or how many times they appear on the command line.
- .PP
- See the fBExamplesfR below on how to set an option differently for
- multiple routers.
- .IP "fB--helpfR" 4
- .IX Item "--help"
- Print a brief help message and exit.
- .IP "fB--manfR" 4
- .IX Item "--man"
- Prints the manual page and exits.
- .IP "fB--versionfR" 4
- .IX Item "--version"
- Print the version of cfgmaker. This should match the version of s-1MRTGs0
- for which config files are being created.
- .IP "fB--ifreffR fBnrfR|fBipfR|fBethfR|fBdescrfR|fBnamefR" 4
- .IX Item "--ifref nr|ip|eth|descr|name"
- Select the interface identification method. Default is fBnrfR which
- identifies the router interfaces by their number. Unfortunately the
- interface numbering scheme in an s-1SNMPs0 tree can change. Some routers
- change their numbering when new interfaces are added, others change
- thier numbering every full moon just for fun.
- .Sp
- To work around this sad problem s-1MRTGs0 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.
- .Sp
- Select fBipfR to identify the interface by its s-1IPs0 number. Use fBethfR to
- use the ethernet address for identification. Use fBdescrfR to use
- the Interface description. Or use fBnamefR to use the Interface name.
- .Sp
- If your chosen method does not allow unique interface identification on
- the device you are querying, fBcfgmakerfR will tell you about it.
- .IP "fB--ifdescfR fBnrfR|fBipfR|fBethfR|fBdescrfR|fBnamefR|fBtypefR|fBaliasfR" 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-1HTMLs0 code defined in the target's f(CW*(C`PageTop[]*(C'fR. Default is to use
- &fBnrfR 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 fBipfR if you want
- to use the interface's IP-address. Use fBethfR if you want to use the
- interface's ethernet address. If you want a better description, you can
- use either fBdescrfR, fBnamefR or fBaliasfR. 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-1IOSs0 using fBnamefR
- might result in f(CW"S0"fR being the interface description , fBdescrfR might result
- in f(CW"Serial0"fR and fBaliasfR 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 fBtypefR.
- .IP "fB--if-filterfR 'fBfilter-expressionfR'" 4
- .IX Item "--if-filter 'filter-expression'"
- First of all, this is under some developement and is experimental.
- .Sp
- Use this if you want to have better control over what interfaces gets
- included into the configuration. The fBfilter-expressionfR 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-templatefR fBtemplate-filefR" 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-filefR
- 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 Temaplates*(R" below.
- .IP "fB--host-templatefR fBtemplate-filefR" 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-1CPUs0 utilization, ping response time to the host, number of busy
- modems etc. The contents of the file fBtemplate-filefR 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--communityfR fBcommunity-stringfR" 4
- .IX Item "--community community-string"
- Use this to set the community for the routers following on the command
- line to fBcommunity-stringfR. Individual routers might overrride this
- community string by using the syntax fBcommunityfRfB@fRfBrouterfR.
- .IP "fB--enable-ipv6fR" 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-1SNMPs0
- over IPv6.
- .IP "fB--use-16bitfR" 4
- .IX Item "--use-16bit"
- This option forces the use of 16bit s-1SNMPs0 request IDs. Some broken s-1SNMPs0
- 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-optionsfR :[fBportfR][:[fBtimeoutfR][:[fBretriesfR][:[fBbackofffR][:fBversionfR]]]]" 4
- .IX Item "--snmp-options :[port][:[timeout][:[retries][:[backoff][:version]]]]"
- Use this to set the default s-1SNMPs0 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-optionsfR by using the syntax
- .Sp
- &fBrouterfR[:[fBportfR][:[fBtimeoutfR][:[fBretriesfR][:[fBbackofffR][:fBversionfR]]]]]
- .ie n .IP "fB--globalfR fB""fRfIbla: abcfRfB""fR" 4
- .el .IP "fB--globalfR fB``fRfIbla: abcfRfB''fR" 4
- .IX Item "--global ""bla: abc"""
- Use this to add global options to the generated config file.
- You can call fB--globalfR 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--globalfR 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--noreversednsfR" 4
- .IX Item "--noreversedns"
- Do not try to reverse lookup s-1IPs0 numbers ... a must for s-1DNSs0 free environments.
- .IP "fB--no-downfR" 4
- .IX Item "--no-down"
- Normally cfgmaker will not include interfaces which are marked
- anything but administratively and operationally s-1UPs0. With this
- switch you get them all.
- .IP "fB--show-op-downfR" 4
- .IX Item "--show-op-down"
- Include interfaces which are operatively down.
- .IP "fB--zero-speedfR fIspeedfR" 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--subdirsfR fIformatfR" 4
- .IX Item "--subdirs format"
- Give each router its own subdirectory for the s-1HTMLs0 and graphics (or
- &.rrd) files. The directory name is the given fIformatfR string with a
- couple of pattern replacements. The string *(L"s-1HOSTNAMEs0*(R" will be
- replaced by the hostname of the router (however you specified it on
- the fBcfgmakerfR commandline *(-- it may be an actual hostname or just an
- &s-1IPs0 address), and *(L"s-1SNMPNAMEs0*(R" 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--outputfR fIfilefR" 4
- .IX Item "--output file"
- Write the output from fBcfgmakerfR into the file fIfilefR. The default
- is to use f(CW*(C`STDOUT*(C'fR. fB--outputfR is expected to appear only once on the
- command line. If used multiple times, the file specified by the last
- &fB--outputfR will be used.
- .IP "fB--nointerfacesfR" 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--interfacesfR" 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.
- .Sh "s-1SNMPs0 V3 Options"
- .IX Subsection "SNMP V3 Options"
- &fBCfgmakerfR supports s-1SNMPs0 V3. There are optional parameters affecting s-1SNMPs0 operation.
- .PP
- fISNMPv3 ArgumentsfR
- .IX Subsection "SNMPv3 Arguments"
- .PP
- A s-1SNMPs0 context is a collection of management information accessible by a s-1SNMPs0
- entity. An item of management information may exist in more than one context
- and a s-1SNMPs0 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-1SNMPs0 message optionally take a fB--contextengineidfR and fB--contextnamefR
- argument to configure these fields.
- .IP "Context Engine s-1IDs0" 4
- .IX Item "Context Engine ID"
- The fB--contextengineidfR 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--contextengineidfR 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-1SNMPs0 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--contextnamefR 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 ArgumentsfR
- .IX Subsection "User-based Security Model Arguments"
- .PP
- The User-based Security Model (s-1USMs0) used by SNMPv3 requires that a securityName
- be specified using the fB-usernamefR argument. The creation of a Net::SNMP
- object with the version set to SNMPv3 will fail if the fB--usernamefR argument
- is not present. The fB-usernamefR 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--authkeyfR
- or fB--authpasswordfR arguments are specified, the securityLevel becomes
- &'authNoPriv'. The fB--authpasswordfR argument expects a string which is at
- least 1 octet in length. Optionally, the fB--authkeyfR argument can be used so
- that a plain text password does not have to be specified in a script. The
- &fB--authkeyfR 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-96s0 *(L"s-1MD5s0*(R"
- (s-1RFCs0 1321) and s-1HMAC-SHA-96s0 *(L"s-1SHA-1s0*(R" (s-1NISTs0 s-1FIPSs0 s-1PUBs0 180-1). The default
- algorithm used by the module is s-1HMAC-MD5-96s0. This behavior can be changed by
- using the fB--authprotocolfR argument. This argument expects either the string
- &'md5' or 'sha' to be passed to modify the hash algorithm.
- .PP
- By specifying the arguments fB--privkeyfR or fB--privpasswordfR 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--authkeyfR or fB--authpasswordfR arguments are
- missing, the creation of the object fails. The fB--privkeyfR and
- &fB--privpasswordfR arguments expect the same input as the fB--authkeyfR and
- &fB--authpasswordfR arguments respectively.
- .PP
- The User-based Security Model described in s-1RFCs0 3414 defines a single encryption
- protocol to be used for privacy. This protocol, CBC-DES *(L"s-1DESs0*(R" (s-1NISTs0 s-1FIPSs0 s-1PUBs0
- 46-1), is used by default or if the string 'des' is passed to the
- &fB--privprotocolfR 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-EDEs0 *(L"Triple-DES*(R" (s-1NISTs0 s-1FIPSs0 46-3) in the
- User-based Security Model. This protocol can be selected using the
- &fB--privprotocolfR 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/256s0 *(L"s-1AESs0*(R" (s-1NISTs0 s-1FIPSs0 s-1PUBs0 197) in the
- &s-1USMs0. The three s-1AESs0 encryption protocols, differentiated by their key sizes,
- can be selected by passing 'aescfb128', 'aescfb192', or 'aescfb256' to the
- &fB-privprotocolfR argument.
- .Sh "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 imples 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 """fBandfR"" (equivalent with ""fB&&fR"")" 4
- .el .IP "``fBandfR'' (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: fIexpression1fR fBandfR fIexpression2fR
- .ie n .IP """fBorfR"" (equivalent with ""fB||fR"")" 4
- .el .IP "``fBorfR'' (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: fIexpression1fR fBorfR fIexpression2fR
- .ie n .IP """fBnotfR"" (equivalent with ""fB!fR"")" 4
- .el .IP "``fBnotfR'' (equivalent with ``fB!fR'')" 4
- .IX Item """not (equivalent with !"")"
- Boolean negation of a single expression. Example: fBnotfR fIexpressionfR .
- Yet another example: fB!fRfIexpressionfR
- .PP
- (For more details on this I recommend a book on Perl)
- .PP
- fIPredefined Filter VariablesfR
- .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 qoutes will avoid such accidental
- evaluation:
- .PP
- .Vb 1
- & '--if-filter=($default_iftype && $if_admin)'
- .Ve
- .IP "fB$if_typefR" 4
- .IX Item "$if_type"
- This is an integer specifying the interface type as
- per the s-1SNMPs0 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 varables below. Normally, cfgmaker puts in the target's
- PageTop this iftype value within paranthesis 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 25
- & 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 Asymetric Digital Subscriber Loop (ADSL)
- & 117 Gigabit Ethernet
- & 134 ATM Sub Interface
- .Ve
- .IP "fB$defaultfR" 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-downfR and fB--show-op-downfR into
- account) and it's type (and a few other things).
- .IP "fB$default_ifstatefR" 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-downfR and fB--show-op-downfR).
- .IP "fB$default_iftypefR" 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$if_adminfR" 4
- .IX Item "$if_admin"
- True if and only if the interface is in an adminstrative up
- state.
- .IP "fB$if_operfR" 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 cathegory 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$if_is_ethernetfR" 4
- .IX Item "$if_is_ethernet"
- True for ethernet interfaces (nr 6, 7, 26, 62, 69 and 117).
- .IP "fB$if_is_isdnfR" 4
- .IX Item "$if_is_isdn"
- True for various s-1ISDNs0 interface types (nr 20, 21, 63, 75, 76 and 77)
- .IP "fB$if_is_dialupfR" 4
- .IX Item "$if_is_dialup"
- True for dial-up interfaces such as s-1PPPs0 as well
- as s-1ISDNs0. (nr 23, 81, 82 and 108 in addition to the numbers of
- &fB$if_is_isdnfR).
- .IP "fB$if_is_atmfR" 4
- .IX Item "$if_is_atm"
- True for miscellaneous s-1ATMs0 related interface types (nr 37, 49, 107, 105,
- 106, 114 and 134).
- .IP "fB$if_is_wanfR" 4
- .IX Item "$if_is_wan"
- True for s-1WANs0 interfaces point to point, Frame Relay and High Speed Serial ( 22,32,44,46)
- .IP "fB$if_is_lanfR" 4
- .IX Item "$if_is_lan"
- True for s-1LANs0 interfaces (8, 9, 11, 15, 26, 55, 59, 60 and 115 in addition
- to the numbers of fB$if_is_ethernetfR).
- .IP "fB$if_is_dslfR" 4
- .IX Item "$if_is_dsl"
- True for s-1ADSLs0, s-1RDSLs0, s-1HDSLs0 and s-1SDSLs0 (nr 94, 95, 96, 97)
- .IP "fB$if_is_loopbackfR" 4
- .IX Item "$if_is_loopback"
- True for software loopback interfaces (nr 24)
- .IP "fB$if_is_ciscovlanfR" 4
- .IX Item "$if_is_ciscovlan"
- True for Cisco s-1VLANs0 interfaces (interfaces with the
- word Vlan or s-1VLANs0 in their ifdescs)
- .IP "fB$if_vlan_idfR" 4
- .IX Item "$if_vlan_id"
- Returns the vlan id associated with a specific port
- on Cisco Catalyst switches under both Catalyst s-1OSs0
- and s-1IOSs0. If it is not a vlan interface, will return undef.
- .IP "fB$if_MTUfR" 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 avaiable in the future instead.
- .PP
- fIExamples on FiltersfR
- .IX Subsection "Examples on Filters"
- .PP
- The following filter will not affect which interfaces get's included or
- excluded, it will make cfgmaker behave as normally.
- .PP
- .Vb 1
- & '--if-filter=$default'
- .Ve
- .PP
- The following filter will make cfgmaker exclude s-1PPPs0 (23) interfaces:
- .PP
- .Vb 1
- & '--if-filter=$default && $if_type!=23'
- .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
- & '--if-filter=$if_admin && $default_iftype'
- .Ve
- .Sh "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-1HTMLs0 code some of them have an *(L"HTML-escaped*(R" variant, e.g
- &f(CW$html_syslocationfR is the s-1HTMLs0 escaped variant of f(CW$syslocationfR. The s-1HTMLs0
- 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-1BRs0>*(R" and appended with a space character (if a newline is last in the
- string it is not touched).
- .PP
- fIWritable Template VariablesfR
- .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$target_linesfR are turned into comments by adding a hash mark
- (*(L"#*(R") at their beginning. Then all the variables fB$head_linesfR,
- &fB$problem_linesfR , fB$target_linesfR and fB$separator_linesfR
- are concatenated together to form the lines to add to the configuration file.
- .IP "fB$target_linesfR" 4
- .IX Item "$target_lines"
- This variable is the placeholder for the configuration lines created
- by the template. fB$target_linesfR is predefined to be empty when
- the template code is evaluated.
- .IP "fB$head_linesfR" 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$head_linesfR during evaluation,
- the comment will look like usual in the config file.
- .IP "fB$problem_linesfR" 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$problem_linesfR 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$problem_linesfR to find out if
- an interface will be included or rejected but this is not recommended.
- Test against fB$if_okfR instead.
- .IP "fB$separator_linesfR" 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 VariablesfR
- .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 VariablesfR
- .IX Subsection "Host and System Variables"
- .IP "fB$router_namefR" 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-domainfR.
- .IP "fB$router_connectfR" 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--communityfR, fB--snmp-optionsfR and fB--dns-domainfR.
- (There's no s-1HTMLs0 escaped variant available)
- .IP "fB$directory_namefR" 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--subdirsfR command line option. If fB--subdirsfR isn't specified
- &fB$directory_namefR will be the empty string. (There's no s-1HTMLs0 escaped
- variant available)
- .IP "fB$syscontactfR" 4
- .IX Item "$syscontact"
- This variable is the router's s-1SNMPs0 sysContact value. (s-1HTMLs0 escaped
- variant: fB$html_syscontactfR)
- .IP "fB$sysnamefR" 4
- .IX Item "$sysname"
- This variable is the router's s-1SNMPs0 sysName value. (No s-1HTMLs0 escaped
- variant available)
- .IP "fB$syslocationfR" 4
- .IX Item "$syslocation"
- This variable is the router's s-1SNMPs0 sysLocation value. (s-1HTMLs0 escaped
- variant: fB$html_syslocationfR)
- .IP "fB$sysdescrfR" 4
- .IX Item "$sysdescr"
- This variable is the router's s-1SNMPs0 sysDescr value. It is normally not used
- by cfgmaker but might be useful in a template. (s-1HTMLs0 escaped variant:
- &fB$html_sysdescrfR)
- .PP
- fIInterface Target Related VariablesfR
- .IX Subsection "Interface Target Related Variables"
- .IP "fB$target_namefR" 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-1HTMLs0 escaped variant available)
- .IP "fB$if_reffR" 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--ifreffR command line option.
- It is normally used together with fB$router_connectfR.
- (There's no s-1HTMLs0 escaped variant available)
- .IP "fB$if_okfR" 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$problem_linesfR to find out if an interface will be rejected
- or not, use this fB$if_okfR instead.
- .IP "fB$default_target_linesfR" 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-1HTMLs0 escaped variant, text in them is
- &s-1HTMLs0 escaped where needed. Also note that they do not have any newline
- at the end.
- .IP "fB$default_target_directivefR" 4
- .IX Item "$default_target_directive"
- This variable contains the default string for the Target[] directive line.
- .IP "fB$default_setenv_directivefR" 4
- .IX Item "$default_setenv_directive"
- This variable contains the default string for the SetEnv[] directive line.
- .IP "fB$default_directory_directivefR" 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$default_maxbytes_directivefR" 4
- .IX Item "$default_maxbytes_directive"
- This variable contains the default string for the MaxBytes[] directive line.
- .IP "fB$default_title_directivefR" 4
- .IX Item "$default_title_directive"
- This variable contains the default string for the Title[] directive line.
- .IP "fB$default_pagetop_directivefR" 4
- .IX Item "$default_pagetop_directive"
- This variable contains the default string for the PageTop[] directive lines.
- .PP
- fIInterface Network Configuration VariablesfR
- .IX Subsection "Interface Network Configuration Variables"
- .IP "fB$if_ipfR" 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-1HTMLs0 escaped variant available)
- .IP "fB$ifindexfR" 4
- .IX Item "$ifindex"
- This variable is the s-1SNMPs0 ifIndex for the interface which per definition
- always is an integer. (There's no s-1HTMLs0 escaped variant available)
- .IP "fB$if_indexfR" 4
- .IX Item "$if_index"
- Equivalent with fB$ifindexfR.
- .IP "fB$if_ethfR" 4
- .IX Item "$if_eth"
- Contains the ethernet address of the interface, if any. (There's no s-1HTMLs0
- escaped variant available)
- .IP "fB$if_speedfR" 4
- .IX Item "$if_speed"
- This variable is the speed in bytes/second (with prefixes). (There's no
- &s-1HTMLs0 escaped variant available)
- .IP "fB$if_speed_strfR" 4
- .IX Item "$if_speed_str"
- This variable is a cooked speed description which is either in bits or
- bytes depending on wether or not the bits option is active and also with
- the proper prefix for the speed (k, M, G etc). (No s-1HTMLs0 escaped variant
- available)
- .IP "fB$if_type_descfR" 4
- .IX Item "$if_type_desc"
- This variable is a textual description of the interface type. (s-1HTMLs0
- escaped variant: fB$html_if_type_descfR)
- .IP "fB$if_type_numfR" 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-1DETAILSs0 s-1ONs0 s-1FILTERSs0 above). (No s-1HTMLs0 escaped variant available)
- .IP "fB$if_dns_namefR" 4
- .IX Item "$if_dns_name"
- This is the s-1DNSs0 name for the interface. (No s-1HTMLs0 escaped variant available)
- .PP
- fIInterface Name, Description and Alias VariablesfR
- .IX Subsection "Interface Name, Description and Alias Variables"
- .PP
- It might seem confusing with both fINamefR, fIDescriptionfR and fIAliasfR in
- this context and to some extent it is. fINamefR and fIDescriptionfR are
- usually supported on most equipment but how they are used varies, both
- between manufacturers as well as between different cathegories of equipment
- from the same manufacturer. The fIAliasfR is at least supported by Cisco
- &s-1IOSs0, and that variable contains whatever is used in the s-1IOSs0 statement
- called *(L"description*(R" for the interface (not to be confused with the s-1SNMPs0
- variables for fIDescriptionfR).
- .PP
- For better control from the command line consider fB$if_title_descfR which contents
- are controlled by the fB--if-descrfR command line option.
- .IP "fB$if_snmp_descrfR" 4
- .IX Item "$if_snmp_descr"
- This variable should contain the *(L"raw*(R" description of the interface as
- determined by the s-1SNMPs0 polling of the router. (s-1HTMLs0 escaped variant:
- &fB$html_if_snmp_descrfR)
- .IP "fB$if_snmp_namefR" 4
- .IX Item "$if_snmp_name"
- The *(L"raw*(R" name for the interface as provided by s-1SNMPs0 polling. (s-1HTMLs0 escaped
- variant: fB$html_if_snmp_namefR)
- .IP "fB$if_snmp_aliasfR" 4
- .IX Item "$if_snmp_alias"
- The *(L"raw*(R" ifAlias for the interface as provided by s-1SNMPs0 polling. (s-1HTMLs0
- escaped variant: fB$html_if_snmp_aliasfR)
- .IP "fB$if_cisco_descrfR" 4
- .IX Item "$if_cisco_descr"
- The *(L"raw*(R" CiscolocIfDescr for the interface as provided by s-1SNMPs0 polling.
- (s-1HTMLs0 escaped variant: fB$html_if_cisco_descrfR)
- .IP "fB$if_descriptionfR" 4
- .IX Item "$if_description"
- This is the *(L"cooked*(R" description string for the interface, taking into account
- the s-1SNMPs0 values found for the interface's RDescr, ifAlias and
- CiscolocIfDescr. (s-1HTMLs0 escaped variant: fB$html_if_descriptionfR)
- .IP "fB$if_titlefR" 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$desc_prefixfR,
- &fB$if_title_descfR and fB$sysnamefR.
- .Sp
- As fB$if_titlefR depends on fB$if_title_descfR, it is possible to indirectly
- control fB$if_titlefR by using the command line option fB--if-descrfR.
- .Sp
- (s-1HTMLs0 escaped variant: fB$html_if_titlefR)
- .IP "fB$if_port_namefR" 4
- .IX Item "$if_port_name"
- If the host is a Cisco Catalyst s-1LANs0 switch, this variable is the name of
- that port. (No s-1HTMLs0 escaped variant available)
- .IP "fB$desc_prefixfR" 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-1HTMLs0 escaped variant: fB$html_desc_prefixfR)
- .IP "fB$if_title_descfR" 4
- .IX Item "$if_title_desc"
- This is the description of the interface normally used by cfgmaker as part
- of the variable fB$if_titlefR. The latter is used as the full string in the
- &*(L"Title[]*(R" directove and the H1 section in the PageTop[].
- .Sp
- &fB$if_title_descfR is controlled by the command line option fB--if-descrfR
- which indirectly controls the contents of fB$if_titlefR
- .Sp
- (s-1HTMLs0 escaped variant: fB$html_if_title_descfR)
- .PP
- fIHelp Functions for TemplatesfR
- .IX Subsection "Help Functions for Templates"
- .PP
- The following functions exists to facilitate the writing of host and
- interface templates.
- .IP "fBhtml_escape(f(BIstringfB)fR" 4
- .IX Item "html_escape(string)"
- &fBf(BIhtml_escape()fBfR 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-1BRs0>*(R" and appended with a space character
- (newlines at the end of the string are not touched).
- .PP
- fIExample Template FilesfR
- .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 .= <<ECHO;
- .Ve
- .PP
- .Vb 3
- & Target[$target_name]: $if_ref:$router_connect
- & SetEnv[$target_name]: MRTG_INT_IP="$if_ip" MRTG_INT_DESCR="$if_snmp_descr"
- & ECHO
- .Ve
- .PP
- .Vb 3
- & if ($directory_name) {
- & $target_lines .= "Directory[$target_name]: $directory_nameen";
- & }
- .Ve
- .PP
- .Vb 27
- & $target_lines .= <<ECHO;
- & MaxBytes[$target_name]: $if_speed
- & Title[$target_name]: $html_desc_prefix$html_if_title_desc -- $sysname
- & PageTop[$target_name]: <h1>$html_desc_prefix$html_if_title_desc -- $sysname</h1>
- & <div id="sysdetails">
- & <table>
- & <tr>
- & <td>System:</td>
- & <td>$sysname in $html_syslocation</td>
- & </tr>
- & <tr>
- & <td>Maintainer:</td>
- & <td>$html_syscontact</td>
- & </tr>
- & <tr>
- & <td>Description:</td>
- & <td>$html_if_description</td>
- & </tr>
- & <tr>
- & <td>ifType:</td>
- & <td>$html_if_type_desc ($if_type_num)</td>
- & </tr>
- & <tr>
- & <td>ifName:</td>
- & <td>$html_if_snmp_name</td>
- & </tr>
- & ECHO
- .Ve
- .PP
- .Vb 6
- & $target_lines .= <<ECHO if defined $if_port_name;
- & <tr>
- & <td>Port Name:</td>
- & <td>$if_port_name</td>
- & </tr>
- & ECHO
- .Ve
- .PP
- .Vb 6
- & $target_lines .= <<ECHO;
- & <tr>
- & <td>Max Speed:</td>
- & <td>$if_speed_str</td>
- & </tr>
- & ECHO
- .Ve
- .PP
- .Vb 6
- & $target_lines .= <<ECHO if $if_ip;
- & <tr>
- & <td>Ip:</td>
- & <td>$if_ip ($if_dns_name)</td>
- & </tr>
- & ECHO
- .Ve
- .PP
- .Vb 10
- & $target_lines .= <<ECHO;
- & </table>
- & </div>
- & ECHO
- & } else {
- & $head_lines="";
- & $problem_lines="";
- & $target_lines="";
- & $separator_lines="";
- & }
- .Ve
- .PP
- fITemplate Example 2: Simplier Version of Example 1fR
- .IX Subsection "Template Example 2: Simplier 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 intrested in the easiest way of entirely eliminating those
- reject interfaces, the template below would do the job as well by using
- &fB$default_target_linesfR.
- .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-1CPUs0 Targets for HostsfR
- .IX Subsection "Template Example 3: Creating CPU Targets for Hosts"
- .PP
- Below is an example of a host template.
- .PP
- .Vb 3
- & $head_lines .= <<ECHO;
- & #---------------------------------------------------------------------
- & ECHO
- .Ve
- .PP
- .Vb 1
- & my $target_name = $router_name . ".cpu";
- .Ve
- .PP
- .Vb 1
- & $target_lines .= <<ECHO;
- .Ve
- .PP
- .Vb 35
- & YLegend[$target_name]: Percentage CPU load
- & ShortLegend[$target_name]: %
- & Legend1[$target_name]: CPU load in %
- & Legend2[$target_name]:
- & Legend3[$target_name]: Max Observed CPU load
- & Legend4[$target_name]:
- & LegendI[$target_name]: CPU Load:
- & LegendO[$target_name]:
- & WithPeak[$target_name]: ywm
- & MaxBytes[$target_name]: 100
- & Options[$target_name]: growright, gauge, nopercent
- & Title[$target_name]: $router_name CPU load
- & Target[$target_name]: 1.3.6.1.4.1.9.2.1.58.0&1.3.6.1.4.1.9.2.1.58.0:$router_connect
- & PageTop[$target_name]: <h1>$router_name CPU load</h1>
- & <div>
- & <table>
- & <tr>
- & <td>System:</td>
- & <td>$router_name in $html_syslocation</td>
- & </tr>
- & <tr>
- & <td>Maintainer:</td>
- & <td>$html_syscontact</td>
- & </tr>
- & <tr>
- & <td>Description:</td>
- & <td>$html_sysdescr</td>
- & </tr>
- & <tr>
- & <td>Resource:</td>
- & <td>CPU.</td>
- & </tr>
- & </table>
- & </div>
- & ECHO
- .Ve
- .SH "EXAMPLES"
- .IX Header "EXAMPLES"
- The first example creates a config file for fIrouter.place.xyzfR: the router
- has the community name fIpublicfR. Interfaces get identified by their
- &s-1IPs0 number. Two global options get added to the config file. The
- config file gets redirected to fImrtg.conffR. 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.xyzfR, fIrouter2.place.xyzfR, fIswitch1.place.xyzfR and
- &fIswitch2.place.xyzfR all with the community fIpublicfR.
- .PP
- The two routers will have fB--ifreffR set to fBdescrfR whilst the two
- switches will use fB--ifreffR set to fBnamefR. Further the routers will
- use fB--ifdescfR set to fBaliasfR and fIswitch1.place.xyzfR will use
- &fB--ifdescfR set to fBdescrfR whilst fIswitch2.place.xyzfR use fBnamefR 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--communityfR,
- &fB--snmp-optionsfR and fB--dns-domainfR to make the command line
- simpler. All the equipment will use the community fIhiddenfR, except for
- the ppp-server which use community fIaccessfR. All equipment uses these
- &s-1SNMPs0 options: fB1s timeoutfR, fB1 retryfR and fBs-1SNMPs0 version 2fR (fBbackofffR and
- &fBportfR is unspecified which means they use the default values).
- The exception again is the ppp-server which uses fBs-1SNMPs0 version 1fR.
- Finally, all the equipment is part of the domain fIplace.xyzfR, except
- for the ppp-server which is part of the domain fIremote.place.xyzfR.
- Note that the latter is achieved simply by specifying the name
- of the ppp-server to be fIppp-server.f(BIremotefIfR .
- .PP
- .Vb 18
- & 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 <tobi@oetiker.ch> and
- Jakob Ilves <jakob.ilves@oracle.com>
- .SH "LICENSE"
- .IX Header "LICENSE"
- &s-1GNUs0 General Public License
- .SH "COPYRIGHT"
- .IX Header "COPYRIGHT"
- Cfgmaker is Copyright 2000 by Tobias Oetiker <tobi@oetiker.ch>