Graphing Maximum Values
From torrus
This page describes how to configure Torrus to graph maximum values as well as average values (in the MRTG style). This information is stored by default in the RRD files, but we must add extra configuration to make it visible.
This configuration example only applies to the InOut_Bps page for devices that are using 64bit counters (which is most modern devices). Hopefully after reading this it should be clear how to make the changes to other types of multigraph, but if it's not, please feel free to email me and I'll help if I can.
The final result will look something like this:
Contents |
1) Define additional graph styles for the new lines
Create a file called "maximum-schema.pl" with the contents below. On my installation I created as in "/usr/local/torrus/etc/conf/maximum-schema.pl", but you'll need to pick a sensible location based on your distribution and layout:
$Torrus::Renderer::graphStyles{'MaxBpsIn'}{'color'} = '##darkgreen';
$Torrus::Renderer::graphStyles{'MaxBpsIn'}{'line'} = 'LINE1';
$Torrus::Renderer::graphStyles{'MaxBpsOut'}{'color'} = '##magenta';
$Torrus::Renderer::graphStyles{'MaxBpsOut'}{'line'} = 'LINE1';
Include the new schema by adding the following line to "etc/conf/torrus-siteconfig.pl":
$Torrus::Renderer::stylingProfileOverlay = $Torrus::Global::cfgSiteDir . "/maximum-schema.pl";
2) Create the XML configuration
This is the meat of the configuration. We are redefining the template for the Max Bps view to include the additional lines. Create the file "xmlconfig/generic/rfc2863-max.if-mib.xml" as below:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<param-properties>
</param-properties>
<datasources>
<template name="ifxtable-hcoctets-max">
<leaf name="Bytes_In">
<param name="snmp-object" value="$ifHCInOctets.%ifindex-map%" />
<param name="snmp-object-type" value="COUNTER64" />
<param name="rrd-ds" value="ifHCInOctets" />
<param name="rrd-create-dstype" value="COUNTER" />
<param name="ext-dstype" value="COUNTER64" />
<param name="rrd-create-max" value="1e15"/>
<param name="ext-counter-max" value="1e15"/>
<param name="comment" value="Input byte counter for the interface" />
<param name="graph-legend" value="Bytes in" />
<param name="vertical-label" value="Bps" />
<param name="graph-lower-limit" value="0" />
<param name="precedence" value="990" />
</leaf>
<leaf name="Bytes_Out">
<param name="snmp-object" value="$ifHCOutOctets.%ifindex-map%" />
<param name="snmp-object-type" value="COUNTER64" />
<param name="rrd-ds" value="ifHCOutOctets" />
<param name="rrd-create-dstype" value="COUNTER" />
<param name="ext-dstype" value="COUNTER64" />
<param name="rrd-create-max" value="1e15"/>
<param name="ext-counter-max" value="1e15"/>
<param name="comment" value="Output byte counter for the interface" />
<param name="graph-legend" value="Bytes out" />
<param name="vertical-label" value="Bps" />
<param name="graph-lower-limit" value="0" />
<param name="precedence" value="980" />
</leaf>
<leaf name="InOut_bps">
<param name="comment" value="Input and Output bits per second graphs" />
<param name="vertical-label" value="bps" />
<param name="graph-lower-limit" value="0" />
<param name="rrd-hwpredict" value="disabled" />
<param name="precedence" value="1000" />
<param name="ds-type" value="rrd-multigraph" />
<param name="ds-names" value="in,out,maxin,maxout" />
<param name="ds-expr-in" value="{Bytes_In},8,*" />
<param name="graph-legend-in" value="Bits per second in" />
<param name="line-style-in" value="##BpsIn" />
<param name="line-color-in" value="##BpsIn" />
<param name="line-order-in" value="1" />
<param name="ds-expr-out" value="{Bytes_Out},8,*" />
<param name="graph-legend-out" value="Bits per second out" />
<param name="line-style-out" value="##BpsOut" />
<param name="line-color-out" value="##BpsOut" />
<param name="line-order-out" value="2" />
<param name="ds-expr-maxin" value="{MAX@Bytes_In},8,*" />
<param name="graph-legend-maxin" value="Max Bits per second in" />
<param name="line-style-maxin" value="##MaxBpsIn" />
<param name="line-color-maxin" value="##MaxBpsIn" />
<param name="line-order-maxin" value="3" />
<param name="ignore-views-maxin" value="short,last24h,last24h-small" />
<param name="ds-expr-maxout" value="{MAX@Bytes_Out},8,*" />
<param name="graph-legend-maxout" value="Max Bits per second out" />
<param name="line-style-maxout" value="##MaxBpsOut" />
<param name="line-color-maxout" value="##MaxBpsOut" />
<param name="line-order-maxout" value="4" />
<param name="ignore-views-maxout" value="short,last24h,last24h-small" />
</leaf>
</template>
</datasources>
</configuration>
This code is identical to the template "ifxtable-hcoctets" in "xmlconfig/generic/rfc2863.if-mib.xml", with the addition of the two extra Data Sources (DS) - maxin and maxout. The final step is to tell Torrus to use our ifxtable-hcoctets-max (in rfc2863-max.if-mib.xml) rather than ifxtable-hcoctets (in rfc2863.if-mib.xml).
3) Configure Torrus to use the new XML template
You have a choice of applying the new XML template per-device, or globally
Per-device
Add the following lines to "etc/conf/devdiscover-siteconfig.pl":
%Torrus::DevDiscover::templateOverlays = (
'maximum-graphs' => {
'RFC2863_IF_MIB::ifxtable-hcoctets' => {
'name' => 'ifxtable-hcoctets-max',
'source' => 'generic/rfc2863-max.if-mib.xml'
}
}
);
Now in the DDX you can apply this parameter to hosts as necessary:
<param name="template-registry-overlays" value="maximum-graphs"/>
Globally
Add the following lines to "etc/conf/devdiscover-siteconfig.pl":
$Torrus::ConfigBuilder::templateRegistry{'RFC2863_IF_MIB::ifxtable-hcoctets'} =
{
'name' => 'ifxtable-hcoctets-max',
'source' => 'generic/rfc2863-max.if-mib.xml'
};
4) Recompile and restart
You may also need to clear out the image cache to see an immediate difference.

