The Torrus configuration consists of several XML files. Once the XML configuration is changed, it must be compiled into the database by executing torrus compilexml
. In addition, when Renderer, Collector and Monitor processes notice the configuration changes, they refresh their information automatically.
The top-level XML element is always <configuration>
, with sub-elements defining various sections, like datasources or views:
<configuration>
<!-- Optional inclusion of other XML files -->
<include filename="myconfig.xml"/>
<datasources>
<!-- Data sources tree definition -->
...
</datasources>
<views>
<!-- View definitions -->
...
</views>
<token-sets>
<!-- Token sets definitions ->
...
</token-sets>
<monitors>
<!-- Monitor definitions ->
...
</monitors>
</configuration>
Multiple XML files are interpreted in additive matter, i.e. <datasources>
section from one file is concatenated with the corresponding sections of previous files. If the same parameter is defined for the same subtree in several input files, the last processed value gets into the configuration.
Additional XML files may be added to the compilation list by means of <include>
statement. They will be processed recursively before the content of the XML file they are referenced from. The argument filename
determines the name of the file in standard XML files directory. It is safe to include the same file several times, Torrus compiler guarantees that files are only processed once.
Some kinds of sections, like <datasources>
, allow to define the same elements two or more times. In this case, the previous parameter values are overridden by the new values.
Each component of the configuration is defined by the set of parameters. They are specified in a common manner, differentiating in parameter names only:
<view name="default-rrd-html">
<param name="view-type" value="html" />
<param name="expires" value="300" />
<param name="html-template" value="default-rrd.html" />
</view>
The parameter value can be specified either by value
XML attribute, or by the text contents of the <param>
element.
Some parameter values require other parameters to be defined, like in the above example: a view of type html
cannot exist without a template.
After all XML files are compiled, the parameters are checked for validity by the compiler.
By default, all XML input is treated as UTF-8 (unicode). This is important because all the HTML output generated by Torrus is encoded UTF-8.
However, you may use Latin1 (ISO-8859-1) encoding in your XML files. In order to ensure correct displaying of non-ASCII characters, the encoding must be specified in your XML files:
<?xml version="1.0" encoding="ISO-8859-1"?>
You need this only in those files containing non-ASCII characters in Latin1 encoding.
In addition, version 1.54_3
or higher of XML::LibXML
is required, and Torrus version 0.0.16 or above.
In the top level of the configuration tree, a number of macros may be defined. Currently they are used in snmp-object
parameter only. Macros are specified with <def>
elements, being the direct children of <definitions>
element:
<configuration>
<definitions>
<!-- IF-MIB:ifTable -->
<def name="ifDescr" value="1.3.6.1.2.1.2.2.1.2" />
<def name="ifPhysAddress" value="1.3.6.1.2.1.2.2.1.6" />
<def name="ifInOctets" value="1.3.6.1.2.1.2.2.1.10" />
<def name="ifInUcastPkts" value="1.3.6.1.2.1.2.2.1.11" />
<def name="ifInErrors" value="1.3.6.1.2.1.2.2.1.14" />
<def name="ifOutOctets" value="1.3.6.1.2.1.2.2.1.16" />
<def name="ifOutUcastPkts" value="1.3.6.1.2.1.2.2.1.17" />
<def name="ifOutErrors" value="1.3.6.1.2.1.2.2.1.20" />
<!-- Default Interface index lookup -->
<def name="IFIDX" value="M($ifDescr, %interface-name%)" />
</definitions>
...
These definitions are global across all XML configuration files, and are referenced with dollar sign and the definition name, e.g.:
<leaf name="ifInErrors">
<param name="snmp-object" value="$ifInErrors.$IFIDX" />
...
Some parameters require special handling during the compilation or at the runtime. The parameter properties define such behaviour in the XML configuration.
Currently two properties are recognized: "remspace" and "expand".
<configuration>
<param-properties>
<!-- Parameters where space is removed from values -->
<prop param="action" prop="remspace" value="1"/>
<prop param="display-rpn-expr" prop="remspace" value="1"/>
<prop param="ds-names" prop="remspace" value="1"/>
...
</param-properties>
Datasources are organized into a tree hierarchy. All parameters are inherited by the subtrees and leafs from their parents, and can be overridden on lower levels.
The datasources tree consists of two key types of components: subtree and leaf. A subtree can have child subtrees or leaves. A leaf can never have children. A subtree represents logical aggregation, while the leaf always represends the actual datasource.
In XML configuration, a child subtree or leaf belongs to the parent element, like the following:
<datasources>
<!-- This is the first child of the tree root -->
<subtree name="Netflow">
<param name="ds-type" value="rrd-file" />
<param name="comment"
value="Netfow data collected by FlowScan with CarrierIn.pm" />
<!-- All Flowscan-generated files reside here -->
<param name="data-dir" value="/var/local/flowscan/graphs" />
<subtree name="Exporters">
<param name="comment" value="Netflow exporting devices" />
...
<!-- all exporters defined here -->
</subtree>
...
<subtree name="Total">
<param name="data-file" value="total.rrd" />
<leaf name="bps">
<param name="comment" value="Bits per second" />
<param name="leaf-type" value="rrd-def" />
<param name="rrd-ds" value="bits" />
<param name="rrd-cf" value="AVERAGE" />
</leaf>
<leaf name="pps">
<param name="comment" value="Packets per second" />
<param name="leaf-type" value="rrd-def" />
<param name="rrd-ds" value="pkts" />
<param name="rrd-cf" value="AVERAGE" />
</leaf>
<leaf name="packlen">
<param name="comment" value="Average packet length in bytes" />
<param name="leaf-type" value="rrd-cdef" />
<param name="rpn-expr" value="{bps},8,/,{pps},/" />
</leaf>
</subtree>
</subtree>
</datasources>
Each subtree or a leaf is identified by a path, the symbolic notation similar to filesystem paths. In any path notation, subtree names always end with slash (/), and this trailing slash is the part of the name. In this case, any subtree is identified by a path ending with slash, while leaf paths always end with a word symbol. The top-level subtree is identified by a single slash.
The other components of the datasouce definition are templates and aliases.
A template is used when it's needed to define multiple different pieces of the configuration in the same way. For instance, the definition for input/output octets and bits can be specified once in a template, and then applied where appropriate.
The piece of XML configuration inside the <template>
element is memorized under the template name, and reproduced in every occurrence of <apply-template>
with the corresponding template name. The template definition must be the direct child element of <configuration>
XML element:
<datasources>
<!-- Default views must be defined -->
<param name="default-subtree-view" value="default-dir-html" />
<param name="default-leaf-view" value="default-rrd-html" />
<!-- Many of our RRDs have the field "bits" - let's define it here -->
<template name="bps">
<leaf name="bps">
<param name="comment" value="Bits per second" />
<param name="leaf-type" value="rrd-def" />
<param name="rrd-ds" value="bits" />
<param name="rrd-cf" value="AVERAGE" />
</leaf>
</template>
...
<subtree name="Total">
<param name="data-file" value="total.rrd" />
<apply-template name="bps" />
<leaf name="pps">
<param name="comment" value="Packets per second" />
<param name="leaf-type" value="rrd-def" />
<param name="rrd-ds" value="pkts" />
<param name="rrd-cf" value="AVERAGE" />
</leaf>
<leaf name="packlen">
<param name="comment" value="Average packet length in bytes" />
<param name="leaf-type" value="rrd-cdef" />
<param name="rpn-expr" value="bps,8,/,pps,/" />
</leaf>
</subtree>
Alias is the alternative symbolic name for a subtree or a leaf. It can be even a name from a different subtree hierarchy. If that alternative hierarchy does not exist, the corresponding subtrees are created:
<subtree name="62.3.44.55">
<alias>/Netflow/ExportersByName/rtrTelehouse1/</alias>
...
Compile-time variables are those defined somewhere in datasource hierarchy, and valid within a given subtree and its children. It is possible to define pieces of XML configuration which are or are not compiled, depending on the value of corresponding variable.
Variables are set by setvar
XML element, with mandatory attributes name
and value
.
Variable values are used in iftrue
and iffalse
XML elements. Mandatory parameter var
specifies the variable name. The child XML elements are compiled if the variable value is true or false, correspondingly. A true value is true
or a nonzero number. Undefined variable is identified as false.
Example:
<template name="cisco-cbqos-classmap-meters">
...
<iftrue var="CiscoIOS_cbQoS::CMNoBufDrop">
<leaf name="Dropped_No_Buffer">
...
</leaf>
</iftrue>
</template>
<subtree name="QoS_Stats">
<setvar name="CiscoIOS_cbQoS::CMNoBufDrop" value="true"/>
....
</subtree>
For any given leaf, some parameters may reference the other parameter values, by embracing the parameter name with percent signs:
<param name="data-file" value="%snmp-host%_hostaverages.rrd" />
The parameter substitution is performed at runtime. The substitution formula may be defined at a higher subtree level, and the substitution itself will occur at leaf level.
The parameter substitution is performed only to those paraneters which are defined with the property "expand".
tree-name
This parameter is automatically added to the root element of the tree and defines the tree name.
ds-type
Mandatory parameter for every datasource leaf. Currently, the following values are recongized:
rrd-file
The datasource is an RRD file generated by some external collector. Implies mandatory parameters: data-dir
, data-file
, leaf-type
.
collector
The datasource is generated by Torrus Collector. Implies mandatory parameters: collector-type
, storage-type
, collector-period
, collector-timeoffset
.
rrd-multigraph
This leaf is dedicated to displaying of multiple other datasources in one graph. It cannot be referenced for any other purpose, because there's no numeric value associated with it.
nodeid
Optional. If defined, it should contain a unique string identifying this particular leaf or subtree.
node-display-name
Optional. If defined, it overrides the subtree or leaf name for displaying. The subtree and leaf names are not allowed to have spaces and special characters, and this parameter helps to display strings as they are, such as router interface names.
comment
Optional. This is a string of text which is displayed when browsing through the tree.
help-text
Optional. This parameter is not inherited by child nodes. If defined, the user is offered a Help shortcut in the given subtree or view. It allows to open a new window with the help text displayed, together with the current path. Some simple markup is allowed in the text, in a format of Template-Toolkit tool: [%em('some text')%]
would be displayed in italics, and [%strong('some text')%]
would be bold.
monitor
Optional. Comma-separated list of monitor names (spaces are allowed) that must be run upon periodic runs of monitor module (see Monitor definitions section of this manual). Monitor schedule parameters must be defined for the monitor to run properly: monitor-period
and monitor-timeoffset
.
monitor-period
, monitor-timeoffset
Mandatory parameters for leaves that have monitor
defined. They define the monitor schedule for each individual datasource. The time for execution is determined by formula:
time + period - (time mod period) + timeoffset
monitor-vars
Required if one or more monitors requires the variables. In monitor's RPN expressions, the variables are referenced as #varname
. These variables are looked up in the leaf's monitor-vars
parameter. The syntax of this parameter is semicolon-delimited name=value
pairs:
<param name="monitor-vars" value="min=300000;max=1000000"/>
monitor-action-target
Optional. Specifies a reference to an alternative leaf which will be used for the monitor action. For example, you might need to see a multigraph leaf in the tokenset instead of one single datasource.
precedence
Optional. Default value: 0
. When rendering, the subtree listing is sorted according to precedence and alphabetic order of names. The higher the precedence, the closer to the top of the list the child node is displayed.
legend
Optional. If given, produces a short listing at the top of the HTML output, with tabulated values. Format: Category1:Value1; Category2:Value2...
. Spaces around the delimiters are ignored.
Example:
<subtree name="rtrZurich1">
<param name="legend">
Location:Zurich;
Contact: John Smith;
Telephone: 01 9911299
</param>
graph-title
A horizontal string at the top of the graph.
graph-legend
Optional. This legend text is printed inside the graph explaining the line color.
vertical-label
Optional. Text to print along Y axsis on the graph.
graph-lower-limit
, graph-upper-limit
Optional. Fix the upper and lower boundaries of the graph.
graph-rigid-boundaries
Optional. When set to "yes", the graph will not expand if the value is outside the lower or upper limit.
rrd-scaling-base
Optional. Valid values are: "1000" and "1024". Default: "1000". Determines the base for kilo-, mega-, and giga- scaling factor. Normally it should be 1000 for traffic counters, and 1024 for memory or storage sizes.
graph-logarithmic
Optional. When set to "yes", the graph is drawn in logarithmic y-axis scale.
line-style
, line-color
These optional parameters override the corresponding ones from the view definition.
default-subtree-view
, default-leaf-view
Mandatory. Determine the default view for a leaf or subtree, correspondingly. See View definitions section of this manual.
rrgraph-views
Mandatory. Defines 5 views to display the graphs. Must contain 5 comma-delimited view names for short-period, daily, weekly, monthly, and yearly view.
tokenset-member
Optional. Adds this leaf or this subtree child leaves to the specified token sets. Tokenset names are comma-separated, and must be defined in <token-sets>
part of configuration.
descriptive-nickname
Optional. If defined, it is used in tokenset members listing as a member identifier, instead of the leaf path.
hidden
Optional. Valid values: yes
, no
. When set to yes
, the leaf or subtree is not displayed in the subtree listing, unless SHOWHIDDEN
option is true. When SHOWHIDDEN
is enabled, the node name and comment are shown in italics.
has-overview-shortcuts
, overview-shortcuts
, overview-subleave-name-X
, overview-shortcut-text-X
, overview-shortcut-title-X
, overview-page-title-X
, overview-direct-link-X
, overview-direct-link-view-X
When has-overview-shortcuts
is set to yes
on a subtree level, default HTML templates expect the five parameters to be set. overview-shortcuts
is a comma-separated list of shortcut names, and for each name "X", overview-subleave-name-X
defines the current subtree's grandchild leaves name which would compose the overview page. When overview-direct-link-X
is set to yes
, the URL under the graph will point to the direct child subtree, and overview-direct-link-view-X
will define the view for that subtree. Usually this view would be expanded-dir-html
.
ignore-lower-limit
, ignore-upper-limit
, ignore-limits
Optional. When set to yes
, they make the renderer ignore graph-lower-limit
, graph-upper-limit
, or both, accordingly. In addition, ignore-limits
disables the graph-rigid-boundaries
parameter.
graph-ignore-decorations
Optional. When set to yes
, the view decorations
are ignored.
graph-disable-gprint
Optional. When set to yes
, the view parameter gprint-values
and other GPRINT-related parameters are ignored.
hrule-legend-name
Optional. If a horizontal rule with the given name is defined, this parameter specifies the legend to be printed.
searchable
Optional. If set to yes
, the corresponding subtree or leaf is included in the search database.
data-dir
Mandatory. Specifies the filesystem directory path where the data files are resided.
data-file
Mandatory. Name of the data file.
leaf-type
Mandatory. Determines the type of RRD access. Recognized values are:
rrd-def
Corresponds to DEF specification in RRDgraph query. Implies two mandatory parameters: rrd-ds
and rrd-cf
, giving the DS name and consolidation function, correspondingly.
rrd-ds
Mandatory when a leaf refers to an RRD file (storage-type=rrd
in collector
leaves or leaf-type=rrd-def
in rrd-file
leaves). The parameter Specifies the RRD datasource name within a file.
rrd-cf
Mandatory under the same conditios as rrd-ds
. Defines the default consolidation function which is used when retrieving the RRD data.
rrd-cdef
Supported for ds-type=rrd-file
only. Corresponds to CDEF specification in RRDgraph query. Implies one mandatory parameter: rpn-expr
, which gives the RPN expression. Other leaves' value references are specified in curly braces. These leaves can be specified as relative or absolute paths in the configuration tree. See RPN expressions in Torrus manual for more details.
graph-step
Optional. If defined, it specifies the minimum step in seconds that is used to draw the graph. This can be useful, for eample, if an average number of events per hour needs to be displayed.
rrd-hwpredict
Optional. If equals to enabled
, then this RRD datasource is expected to have HWPREDICT and all the suite of Holt-Winters consolidation functions. In case of ds-type=collector
, rrd-hwpredict=enabled
indicates that the RRD file must be created with use of Holt-Winters RRAs.
rrd-create-dstype
Mandatory when ds-type=collector
and storage-type=rrd
. Specifies the datasource type for RRD creation. Valid values are: GAUGE
, COUNTER
, DERIVE
, ABSOLUTE
.
rrd-create-rra
Mandatory when ds-type=collector
and storage-type=rrd
. Space-separated list of RRA definitions for RRD creation, as they are passed to RRD Create command. Example:
<!-- Round-robin arrays to be created, separated by space.
In this example, we keep 5-minute details for 2 weeks,
30-minute average and maximum details for 6 weeks,
and 1-day aggregated stats for 2 years -->
<param name="rrd-create-rra">
RRA:AVERAGE:0.5:1:4032
RRA:AVERAGE:0.5:6:2016 RRA:MAX:0.5:6:2016
RRA:AVERAGE:0.5:288:732 RRA:MAX:0.5:288:732
</param>
rrd-create-heartbeat
Mandatory when ds-type=collector
and storage-type=rrd
. Heartbeat parameter as defined in RRD Create manual page.
rrd-create-min
, rrd-create-max
Optional minimum and maximum parameters for RRD datasource.
rrd-create-hw-rralen
Mandatory when ds-type=collector
and storage-type=rrd
and rrd-hwpredict=enabled
. Specifies the RRA length for Holt-Winters archives. Recommended same length as main 5-minutes RRA.
rrd-create-hw-season
, rrd-create-hw-alpha
, rrd-create-hw-beta
, rrd-create-hw-gamma
, rrd-create-hw-winlen
, rrd-create-hw-failth
Optional Holt-Winters parameters. Default values are:
season=288
alpha=0.1, beta=0.0035, gamma=0.1,
window_length=9, failure_threshold=6
collector-type
Mandatory parameter for datasource type collector
. Currently supported values are: snmp
and cdef
. Other valid values may be added with plugins.
storage-type
Mandatory parameter for datasource type collector
. Comma-separated list of storage types. The collected value is duplicated on every storage listed. Supported values are: rrd
, ext
. For ext
(external storage), see the Reporting Setup Guide.
collector-period
, collector-timeoffset
Mandatory parameters for datasource type collector
. They define the collector schedule for each individual datasource. The time for execution is determined by formula:
time + period - (time mod period) + timeoffset
collector-dispersed-timeoffset
Optional. When set to yes
, compilexml
spreads the collector offsets among values determined from collector-timeoffset-min
, collector-timeoffset-max
, collector-timeoffset-step
, and collector-timeoffset-hashstring
.
collector-timeoffset-min
, collector-timeoffset-max
, collector-timeoffset-step
Mandatory when collector-dispersed-timeoffset
is set to yes
. They define the limits and the step for collector timeoffset dispersion.
collector-timeoffset-hashstring
Mandatory when collector-dispersed-timeoffset
is set to yes
. Defines the string that is used as a hash for timeoffset dispersion.
collector-instance-hashstring
Mandatory. Defines the string that is used as a hash to calculate the collector instance number for a particular leaf. By default it is defined as %system-id%
, so that the same collector instance deals with every remote system.
collector-instance
Mandatiry. The parameter defines the collector instance number. This parameter is automatically calculated by the configuration compiler.
transform-value
Optional. Defines a piece of Perl code that will be used for value transformation. The keyword DOLLAR
is replaced with the dollar sign ($), and MOD
is replaced with the percent sign (%). The initial value is supplied in $_
, which should be referenced as DOLLAR_
in your Perl code. The code should return a numeric value or U
for an undefined value. The returned value is then passed to the storage. The parameter substititions are performed on the value of the parameter, therefore it should not contain the percent(%) and dollar ($) signs.
value-map
Optional. Collector may return values which need translation into numbers. This parameter defines the mapping for such values. The parameter value is a comma-separated list of value:number
pairs.
collector-scale
Optional. Specifies the translation RPN formula for the data before being passed to RRD database. Implicitly the datasource value is appended to the left of the given RPN. Warning: the translation works before the RRDtool processes the data, so it makes sence to scale only non-COUNTER values.
snmp-ipversion
Mandatory for collector-type=snmp
. Valid values are 4
and 6
. The parameter defines the IP protocol version. If snmp-host
contains a DNS name, the IP address is determined by looking up A or AAAA DNS records, according to IP version.
snmp-transport
Mandatory for collector-type=snmp
. Valid values are tcp
and udp
.
snmp-host
Mandatory when collector-type=snmp
. Specifies the hostname or IP address of the SNMP agent.
snmp-port
Mandatory when collector-type=snmp
. Specifies the UDP port of the SNMP agent.
domain-name
Optional DNS domain name. If given, and if snmp-host
does not contain dot symbol (.), this domain name is appended to snmp-host
.
snmp-localaddr
and snmp-localport
Optional parameters specifying the local socket binding address and port.
snmp-version
Mandatory when collector-type=snmp
. Specifies the SNMP version for the given device. Valid values are: 1
, 2c
, 3
.
snmp-community
Mandatory when collector-type=snmp
and SNMP version is 1
or 2c
. Specifies the SNMP community for the given device.
snmp-username
Mandatory when collector-type=snmp
and SNMP version is 3
.
snmp-contextname
Optional SNMP context name for SNMPv3.
snmp-authkey
Optional authentication key for SNMPv3. If not defined, the authentication level is set to noAuthNoPriv
. If only snmp-authkey
or snmp-authpassword
are specified, the security level is set to authNoPriv
. The security level is set to authPriv
if either of snmp-privkey
or snmp-privpassword
is defined.
snmp-authpassword
Optional authentication password for SNMPv3. See notes for snmp-authkey
parameter.
snmp-authprotocol
Optional authentication protocol for SNMPv3. Valid values: md5
or sha
. Default is md5
.
snmp-privkey
Optional privacy key for SNMPv3. If defined, snmp-authkey
or snmp-authpassword
must be defined too.
snmp-privpassword
Optional privacy password for SNMPv3. If defined, snmp-authkey
or snmp-authpassword
must be defined too.
snmp-privprotocol
Optional privacy protocol for SNMPv3. Valid values: des
, aes
, or 3desede
. Default is des
.
snmp-timeout
Mandatory when collector-type=snmp
. Specifies the SNMP session timeout in seconds.
snmp-retries
Mandatory when collector-type=snmp
. Specifies the SNMP session retry count.
snmp-oids-per-pdu
Mandatory when collector-type=snmp
. Specifies the number of SNMP OIDs per one UDP packet.
snmp-object
Mandatory when collector-type=snmp
. Specifies the SNMP OID to be polled from the agent. The object must return a single numeric value.
In order to reference the dynamic instances, i.e. interface counters, two mapping types are supported: reverse mapping and variable value substitution.
Reverse mapping has syntax as follows:
M(baseoid, string)
The result of reverse mapping is the tail of the OID which has the head baseoid
and whose value equals the string.
Variable value substitution is defined by syntax:
V(oid)
The returned value must be a numeric value which is substituted in place of this expression.
snmp-object-type
Optional. Supported values: COUNTER64
, OTHER
. When set to COUNTER64
, the SNMP variable value is treated as 64-bit integer. Not using this parameter may lead to loss of precision.
snmp-check-sysuptime
Optional. Default value: yes
. When set to no
, the collector does not query SNMPv2-MIB::sysUpTime
(1.3.6.1.2.1.1.3.0
). By default, the uptime counter is used to detect if the agent was rebooted between the collector cycles. In this case the dynamic maps for the given host are automatically rebuilt. This parameter is needed for compatibility with some non-standard agents which don't implement this OID.
snmp-max-msg-size
Optional. If defined, it sets the SNMP maximum message size different from default 1472 octets (true for UDP/IPv4, see Net::SNMP documentation for more information).
snmp-ignore-mib-errors
Optional. If set to yes
, the SNMP errors noSuchObject
, noSuchInstance
, endOfMibView
are ignored, and no action is performed when such errors occur.
system-id
Mandatory for every collector type. Default value for SNMP collector: %snmp-host%
. Unique identifier of the host. This parameter is used in various template definitions for data-file
, descriptive-nickname
and collector-timeoffset-hashstring
.
rpn-expr
Mandatory when collector-type=cdef
. The RPN defines an arithmetic expression that is used to create a new datasource from several other ones. For example, it may define the sum of traffic on several different interfaces.
cdef-collector-delay
Mandatory when collector-type=cdef
. Defines the delay time in collector periods. The collector will read the data from the RPN datasources with the specified delay from the current time. cdef-collector-defs.xml sets the default value to 0.
cdef-collector-tolerance
Mandatory when collector-type=cdef
. Delay time in collector periods that the collector accepts when no recent data is available. cdef-collector-defs.xml sets the default value to 2.
The leaves with ds-type=rrd-multigraph
are dedicated for displaying of several datasource values in one graph. Such leaves cannot be referenced for a numerical value, hence cannot be monitored.
Example:
<subtree name="SampleMulti">
<leaf name="sample1">
<param name="ds-type" value="rrd-multigraph" />
<param name="ds-names" value="in,out" />
<param name="foobarpath"
value="/SNMP/Routers/213.230.38.4/FastEthernet0_0" />
<!-- parameter name tail is formed by the DS name -->
<param name="ds-expr-in" value="{%foobarpath%/locIfInBitsSec}" />
<param name="graph-legend-in" value="Bits per second in" />
<param name="line-style-in" value="AREA" />
<param name="line-color-in" value="#00FF00" />
<param name="line-order-in" value="1" />
<param name="ds-expr-out" value="{%foobarpath%/locIfOutBitsSec}" />
<param name="graph-legend-out" value="Bits per second out" />
<param name="line-style-out" value="LINE2" />
<param name="line-color-out" value="#0000FF" />
<param name="line-order-out" value="2" />
</leaf>
</subtree>
Parameters:
ds-names
Comma-separated list of symbolic DS names. These names are used for other DS-specific parameter names formation. In the parameter descriptions below, X
stands for the DS name.
ds-expr-X
Datasource leaf RPN expression. Any other parameter values may be substituted as %parameter_name%
.
graph-legend-X
Short description text used as the graph legend.
line-style-X
Line specification in RRD graph. May be LINE1
, LINE2
etc. Two hashes in the beginning and a name refer to the line style from the styling profile, e.g. ##BpsIn
.
line-color-X
Line color. Must have the hash symbol in the beginning, like #0000FF
. Two hashes in the beginning and a name refer to the color from the styling profile, e.g. ##BpsIn
.
line-order-X
Numerical order of line drawing. The lines are drawn in accending order. If omitted, the XML compiler issues warning, and Renderer conciders the order of 100.
line-stack-X
Optional. When set to yes
, the line is stacked on top of a previous line. Both areas and lines are stackable.
line-alpha-X
Optional. If specified, must be two hexademical, uppercase digits. This parameter defines the line (or area) transparency. Value FF
is equivalent to solid colour. Value 7F
gives 50% transparency which should be suitable for most applications.
ignore-views-X
Optional comma-separated list of view names. The graph for this DS name will not be drawn in the views specified. The validator does not check it, so it's up to you to guarantee that at least one DS is always displayed in a multigraph.
disable-gprint-X
Optional. When set to yes
, this datasource is not included in GPRINT output.
maxline-style-X
and maxline-color-X
Optional parameters that define the style and color for the maximum line. The maxim line usually displays daily or hourly maximums, and the color needs to be contrast enough to be distinctively visible on the graph.
In our context, view means any kind of object representation. The same subtree or view can be displayed in different ways and in different formats: HTML, graph image, plain text, etc.
Renderer module handles these view definitions. For any subtree or leaf, it renders the specified view, and keeps the cache of rendered files.
Each subtree or leaf must have a default view. This is controlled by two parameters that may be defined in the root subtree: default-subtree-view
and default-leaf-view
.
The set of views is flat, though they can inherit the parameters one from another. Each view is referenced by its name, and is defined by the set of parameters. Same way as with datasources, certain parameter values imply the neccessaty to define certain other parameters:
<views>
<view name="default-rrgraph">
<param name="view-type" value="rrgraph" />
<param name="expires" value="300" />
<param name="width" value="500" />
<param name="height" value="250" />
<param name="width-hint" value="580" />
<param name="line-style" value="##SingleGraph" />
<param name="line-color" value="##SingleGraph" />
<!-- Daily graph, inherits parameters from the above -->
<view name="last24h">
<param name="start" value="-24h" />
</view>
<!-- Weekly graph -->
<view name="lastweek">
<param name="start" value="-7d" />
</view>
</view>
</views>
Currently the view is defined by the configuration only. Probably, in the future additional parameters will be supplied dynamically.
For every view, the mandatory parameters are:
view-type
Determines the processing procedure which interprets the other parameters.
expires
Gives the expiration time in seconds for the Renderer cache.
The following values of view-type
are recognized:
html
Defines the HTML representation of subtree or a leaf. One additional parameter is required: html-template
must contain a file name of the HTML template. Those templates are copied from templates subdirectory of the installation package. We use Template-Toolkit <http://www.template-toolkit.org> for HTML processing. The template file name is defined with the parameter html-template
.
The following variables and functions are defined when the template is processed:
token
Returns the current node token.
view
Returns the name of the current view.
path(token)
Returns the full path name of the given node token.
pathToken(path)
Returns the token for the specified path.
nodeExists(path)
Returns true if the specified path points to a node.
children(path)
Returns the list of children for the given path.
isLeaf(token)
Returns true if the token is pointing to a leaf node.
sortTokens(array)
Returns the array of tokens, sorted according to precedence
parameter.
nodeName(token)
Returns the node name part of the node path.
parent(token)
Returns the parent's token for the specified node.
nodeParam(token, param_name)
Returns the value of the parameter for the given node.
param(entity_name, param_name)
Returns the value of the parameter for the given view, monitor, or action.
url(token, [view])
Returns the URL which displays the given node using the given view. If the view is omitted, use the default view.
splitUrls(token, [view])
Returns a piece of HTML code representing the path with clickable node names, each referencing the corresponding view.
rrprint(token, view)
The specified view must be of type rrprint
. Returned is the text output produced by this view.
scale(text)
Interprets the given text as a floating-point number and returns its representation in the "metric" scale: 1000 is translated into "k", million into "M" etc. It may be used together with rrprint
for better formatting.
tsetMembers(tset)
Returns the array of the tokenset member tokens.
tsetList
Returns the array of the tokenset names.
stylesheet
Returns the relative URI to the default CSS stylesheet, as defined in $Torrus::Renderer::stylesheet
.
version
Returns current Torrus package version.
rrgraph
Generates the RRD Graph representation of the given leaf (remember, subtrees are only logical grouping of the real data).
The following parameters are recognized for this kind of view:
width
, height
, start
, end
, imgformat
, border
These view parameters correspond to same parameters in RRD Graph command. end
can also be given, it defaults to now
. The following parameters are mandatory: width
, height
, and start
. border
is only supported in RRDtool version 1.3.9 or higher.
line-style
Mandatory line specification in RRD graph. May be LINE1
, LINE2
etc. Two hashes in the beginning and a name refer to the line style from the styling profile, e.g. ##SingleGraph
.
line-color
Mandatory line color. Must have the hash symbol in the beginning, like #0000FF
. Two hashes in the beginning and a name refer to the color from the styling profile, e.g. ##SingleGraph
.
graph-colors
Optional. The parameter defines the values for the --color
options in RRD Graph command. The value is an even number of color tags and color values, separated by colon (:). For example, "BACK:00FFFF:FONT:AA55DD" corresponds to an ugly cyan background and magenta text.
rrd-hwpredict
Optional. If equals to disabled
, HWPREDICT display is disabled for this view. Note that if the datasource has rrd-hwpredict
parameter set to enabled
, this emplies that the view would contain Holt-Winters boundaries and failures graph.
hw-bndr-style
Optional parameter, defaults to LINE1
. Specifies the line style for Holt-Winters boundaries.
hw-bndr-color
Optional parameter, defaults to #FF0000
. Specifies the color for Holt-Winters boundaries.
hw-fail-color
Optional parameter, defaults to #FFFFA0
. Specifies the color for Holt-Winters failure ticks.
hrules
, hrule-value-name
, hrule-color-name
Optional parameter hrules
contains a comma-separated list of horizontal rule names. For each name, mandatory parameter hrule-value-name
defines a name of the leaf parameter that will be used as the horizontal rule value. The rule is not drawn if such parameter is not defined for the leaf. Mandatory parameter hrule-color-name
defines the color for the rule, of the form #DDDDDD
, where D
corresponds to a hexademical digit. Two hashes in the beginning and a name refer to the color from the styling profile, e.g. ##HruleMin
. Optional parameter hrule-legend-name
defines the legend text to be displayed on the graph. The following horizontal rules are defined in defaults.xml for all rrgraph views:
<param name="hrules" value="min,norm,max"/>
<param name="hrule-color-min" value="##HruleMin"/>
<param name="hrule-value-min" value="lower-limit"/>
<param name="hrule-color-norm" value="##HruleNormal"/>
<param name="hrule-value-norm" value="normal-level"/>
<param name="hrule-color-max" value="##HruleMax"/>
<param name="hrule-value-max" value="upper-limit"/>
decorations
Optional. Comma-separated list of decoration names. Decoration is an RRD pseudo-line that does not depend on any datasource. For each decoration name, the following parameters must be supplied: dec-order-<name>
determines the order of drawing. Negative order numbers correspond to the lines or areas behind the data line. dec-expr-<name>
gives the RPN expression that defines the line or area. dec-style-<name>
and dec-color-<name>
define the style (AREA or LINE1..3) and the color of the drawing. Node parameter graph-ignore-decorations
disables the decorations.
gprint-values
, gprint-header
, gprint-format-*
Optional. These parameters define the printing of values together with legends below the graph. gprint-values
is a comma-separated list of format names, and for each format name, there should be a corresponding gprint-format-*
parameter. gprint-header
defines a string that will be printed on top of all orther lines. Example:
<param name="gprint-values" value="current,average,max,min"/>
<param name="gprint-header"
value="Current Average Maximum Minimum"/>
<param name="gprint-format-current" value="LAST:%8.2lf%s"/>
<param name="gprint-format-average" value="AVERAGE:%8.2lf%s"/>
<param name="gprint-format-max" value="MAX:%8.2lf%s"/>
<param name="gprint-format-min" value="MIN:%8.2lf%s"/>
description
Optional. Defines the text description of the graph. This description is usually placed as ALT HTML attribute in the generated HTML pages.
rrd-params
Optional. Supplies additional RRDtool graph comand-line options, as one string separated by spaces.
rrprint
This view produces the text output from PRINT statement in RRD graph command. The required parameters are start
and print-cf
. The first one defines the starting time. end
may be also optionally specified.
print-cf
specifies one or more consolidation functions, separated by comma. The result of the rendering is the text line with the output values separated by colon (:).
disable-legend
, disable-title
, disable-vertical-label
When set to yes
, the corresponding elements of the graph are not displayed.
Styling profiles allow symbolic names to be used for line type and color.
Two hashes in the beginning and a name refer to the line style from the styling profile, e.g. ##BpsIn
, ##green
, ##one
, ##two
.
<leaf name="InOutBytes">
<param name="comment" value="Input and Output bits per second graphs"/>
<param name="ds-type" value="rrd-multigraph"/>
<param name="ds-names" value="in,out"/>
<!-- IN -->
<param name="ds-expr-in" value="{ifInOctets}"/>
<param name="graph-legend-in" value="Bytes per second in"/>
<param name="line-style-in" value="##BpsIn"/>
<param name="line-color-in" value="##BpsIn"/>
<param name="line-order-in" value="1"/>
<!-- OUT -->
<param name="ds-expr-out" value="{ifOutOctets}"/>
<param name="graph-legend-out" value="Bytes per second out"/>
<param name="line-style-out" value="##BpsOut"/>
<param name="line-color-out" value="##BpsOut"/>
<param name="line-order-out" value="2"/>
</leaf>
When processed the example above effectivly becomes:
<leaf name="InOutBytes">
<param name="comment" value="Input and Output bits per second graphs"/>
<param name="ds-type" value="rrd-multigraph"/>
<param name="ds-names" value="in,out"/>
<!-- IN -->
<param name="ds-expr-in" value="{ifInOctets}"/>
<param name="graph-legend-in" value="Bytes per second in"/>
<param name="line-style-in" value="AREA"/>
<param name="line-color-in" value="#00FF00"/>
<param name="line-order-in" value="1"/>
<!-- OUT -->
<param name="ds-expr-out" value="{ifOutOctets}"/>
<param name="graph-legend-out" value="Bytes per second out"/>
<param name="line-style-out" value="LINE2"/>
<param name="line-color-out" value="#0000FF"/>
<param name="line-order-out" value="2"/>
</leaf>
Schema definitions can be modified in two ways (see the Torrus Styling Profile Guide manual for available styles and override details)
Create an overlay schema:
Specify the overlay schema in torrus-siteconfig.pl using the $Torrus::Renderer::stylingProfileOverlay variable.
Create a replacement schema:
Specify the replacement schema in torrus-siteconfig using the $Torrus::Renderer::stylingProfile variable.
Token is a symbolic identifier for each subtree or a leaf.
A tokenset is a named list of tokens. Its contents can be rendered, and its members can be added or removed at any time.
Each tokenset can have a number of parameters defined. It also inherits the parameter defined in the top <token-sets>
XML element:
<token-sets>
<param name="default-tset-view" value="default-tset-html" />
<param name="default-tsetlist-view" value="tset-list-html" />
<token-set name="jumps">
<param name="comment" value="Traffic rate jumps" />
<param name="rrgraph-view" value="lastweek-small"/>
</token-set>
<token-set name="hw-failures">
<param name="comment" value="Holt-Winters prediction failures" />
</token-set>
</token-sets>
Parameter default-tsetlist-view
is mandatory for tokenset list. It defines the default view when displaying the list of tokensets.
The following parameters are mandatory for tokensets:
default-tset-view
Determines the view for displaying the tokenset contents.
rrgraph-view
Specifies the name of the view that is used to display graphs inside the tokenset. If not specified, the first view in rrgraph-views
from each leaf is used to display the graph.
comment
The text that describes this tokenset.
Monitor is a named set of parameters that defines the behaviour of monitor module. Each leaf can be given a number of monitors via monitor
parameter.
Upon monitor module run, an action is launched if the alarm conditions of a given monitor are satisfied.
<monitors>
<!-- First define the actions -->
<!-- This action will put the graphs of alarmed datasources in
a single alarm report page -->
<action name="graph-hw-failures">
<param name="action-type" value="tset" />
<param name="set-name" value="hw-failures" />
</action>
<action name="graph-jumps">
<param name="action-type" value="tset" />
<param name="set-name" value="jumps" />
</action>
<monitor name="hw-failures">
<param name="monitor-type" value="failures" />
<param name="action" value="graph-hw-failures" />
<param name="expires" value="3600" />
</monitor>
<!-- alarm if 5 minutes away it was 10 times lower -->
<monitor name="high-jumps">
<param name="monitor-type" value="expression" />
<param name="rpn-expr" value="{(-300)},10,*,GT,{},{(-300)},10,/,LT,OR" />
<param name="action" value="graph-jumps" />
<param name="expires" value="3600" />
<param name="comment"
value="Value jumped more than 10-fold in 5 minutes" />
</monitor>
<monitor name="hundred-megs">
<param name="monitor-type" value="expression" />
<param name="rpn-expr" value="100,1024,1024,*,*,GT" />
<param name="action" value="graph-jumps" />
<param name="expires" value="3600" />
<param name="comment"
value="Traffic is higher than 10 mbps" />
</monitor>
</monitors>
Should the alarm condition occur, a series of events is happening in sequentional order:
set
This event type occurs the first time the alarm condition is met.
repeat
This event type means that the alarm condition still persists after the previous run of Monitor.
escalate
If escalation times are defined with escalations
parameter, this event is fired if the alarm condition persists for a specified time. Each escalation event is fired only once.
clear
Event of this type happens when the alarm condition stops.
clear_escalation
After the clear
event is fired, clear_escalation
is also fired for every escalation that was raised before it.
forget
Once the alarm is cleared, this event happens after the expiration time of the monitor.
monitor-type
Mandatory parameter. Specifies the monitor type. The following monitor types are recognized:
failures
Triggers the action when Holt-Winters FAILURES function gives value of 1. This requires RRDtool verion 1.1.x and aberrant behaviour parameters defined for te given RRD file.
expression
Triggers the action when given RPN expression returns nonzero. See RPN expressions in Torrus manual for more details. This monitor type implies that the RPN expression is specified in rpn-expr
parameter. The current leaf value is prepended to the given RPN.
escalations
Optional parameter with comma-separated escalation times. Each escalation time is a period in seconds. As soon as the alarm condition persists for the specified period, an escalate
event is fired.
rpn-expr
Mandatory for monitor type expression
. Defines the RPN expression to evaluate. The current leaf value is prepended to the given RPN. The expresion may reference leaf-dependent variables: the constructs of the form #varname
are replaced with the variable value specified in the leaf's monitor-vars
parameter.
time-span
Optional parameter, a positive integer specifying the time span in seconds. If defined, the data source value is calculated across the defined period with the aggregation function that is defined in rrd-cf
parameter. If not specified, the last available value is taken.
time-zone
Optional parameter. If defined, it should contain a valid time zone name that is resolvable on the local server. This affects the TOD function in RPN expressions. If undefined, the local time zone is used.
action
Mandatory parameter, comma-separated list of action names (spaces are allowed). Each action is triggered when the alarm condition is met.
expires
Mandatory parameter, the number of seconds of expiration period. After the alarm condition becomes false, this parameter determines the time of memorizing the event in monitor status reports.
comment
Optional but recommended parameter, specifies the string identifying the event that this monitor watches.
severity
Optional severity level. Used for the action type exec
.
display-rpn-expr
Optional RPN expression for transforming the datasource value. If defined, it will be applied to the value before setting TORRUS_VALUE
and TORRUS_DISPLAY_VALUE
environment variables.
display-format
Optional sprintf format for displaying the value in TORRUS_DISPLAY_VALUE
environment variable. Default is %.2f
.
action-type
Mandatory parameter, defines the type of action. Recognized values are:
tset
When this type of action is triggered, the leaf is added to the specified tokenset (see Token sets definitions section in this manual). The leaf persists in the tokenset until the event of type forget
. This action type implies the parameter tset-name
.
exec
This action type defines an external program to launch. Two other parameters determinate its behaviour: mandatory command
and optional launch-when
.
tset-name
Mandatory for action type tset
. Defines the tokenset name where the leaf is added when the monitor condition is met.
on-escalations
Optional parameter for action type tset
. It specifies a comma-separated list of escalation times at which the leaf would be added to the tokenset.
command
Mandatory for action type exec
. Defines the external program to launch. The following strings are substituted in the parameter value:
>
Relaced with >
.
<
Relaced with <
.
The following environment variables are passed to the child process:
$TORRUS_HOME
prefix
where Torrus was installed.
$TORRUS_BIN
Directory containing Torrus executables.
$TORRUS_UPTIME
Number of seconds since Monitor has started.
$TORRUS_TREE
, $TORRUS_TOKEN
, $TORRUS_NODEPATH
Tree name, token and pathname of the leaf causing the alarm.
$TORRUS_NCOMMENT
, $TORRUS_NPCOMMENT
comment
parameter of the node and its parent. Empty if the parameter is not defined for the given leaf.
$TORRUS_EVENT
Event type.
$TORRUS_ESCALATION
Escalation time. It is set to zero when the "set" event is fired.
$TORRUS_MONITOR
Monitor name
$TORRUS_MCOMMENT
Monitor's comment
parameter value.
$TORRUS_TSTAMP
Timestamp (in seconds since Epoch) of the event.
$TORRUS_VALUE
For expression monitor type, this returns the last read value of the datasource, possibly transformed by display-rpn-expr
expression.
$TORRUS_DISPLAY_VALUE
For expression monitor type, it contains a human-readable form of the value, possibly transformed by display-rpn-expr
expression.
$TORRUS_SEVERITY
If the severity
parameter is defined in the monitor, its value is passed with this variable.
launch-when
Optional for action type exec
. The comma-separated list of event types when the given action should be launched. If not defined, the event types set,escalate
are used by default.
setenv-params
Optional for action type exec
. The comma-separated list of leaf parameters which would be passed as environment variables to the child process. The environment variables are of the form $TORRUS_P_paramname
. Hyphens ('-') are replaced with underscores ('_') in the parameter names.
setenv-dataexpr
Optional for action type exec
. Comma-separated list of ENV=paramname
pairs. ENV
defines the environment variable name: it is prefixed with Torrus_
. paramname
defines the action parameter name. This parameter is interpreted as RPN expression applied to the current leaf being monitored. The result of this RPN expression is passed to the action script in the environment variable.
Example:
<action name="report-temperature">
<param name="action-type" value="exec" />
<!-- This is our proprietary reporting script -->
<param name="command">
/usr/local/bin/report_temperature
</param>
<param name="launch-when" value="set" />
<!-- We want to tell the action script the actual values
of the "temperature" and "humidity" leaves in the current
datasource tree -->
<param name="setenv-dataexpr" value="TEMP=expr-temp, HMD=expr-hmd" />
<param name="expr-temp" value="{temperature(LAST)}" />
<param name="expr-hmd" value="{humidity(LAST)}" />
<!-- We also want to tell the action script the parameter "monitor-vars"
which was configured for the current leaf. -->
<param name="setenv-params" value="monitor-vars" />
</action>
Copyright (c) 2002-2005 Stanislav Sinyagin <ssinyagin@k-open.com>