Plugin Aggregate Manual v075 PDF
Plugin Aggregate Manual v075 PDF
Plugin Aggregate Manual v075 PDF
Cacti
Aggregate Plugin Version 0.75
Usage Guide
Brought to you by
Reinhard Scheck
gandalf@cacti.net
Table of Contents
Features.................................................................................................................................................3
Installing the Plugin..............................................................................................................................4
Basic Installation Procedure............................................................................................................4
Providing Permissions to Users.......................................................................................................6
Basic Usage..........................................................................................................................................7
Aggregate Options Explained..........................................................................................................8
Modifying the Default Traffic Graph Templates...........................................................................13
Finding Aggregated Graphs................................................................................................................16
Color Templates..................................................................................................................................17
Create a new Color Template.........................................................................................................17
Aggregate Cookbook..........................................................................................................................19
A Variation of Traffic Templates....................................................................................................19
Interface – Traffic (bits/sec) ( default)......................................................................................20
Interface – Traffic (bits/sec) (AREA/STACK)..........................................................................20
Interface – Traffic (bits/sec) (peak)...........................................................................................21
Interface – Traffic (bits/sec) (pos/neg)......................................................................................21
Interface – Traffic (bits/sec) (pure LINE).................................................................................22
Examples........................................................................................................................................23
Using “Interface – Traffic (bits/sec) ( default)”........................................................................23
Keep graph types, print all legend items, total similar data sources, reorder.......................23
Using “Interface – Traffic (bits/sec) (AREA/STACK)”...........................................................23
Convert to AREA/STACK Graph, No Totals, No Reordering.............................................23
Using “Interface – Traffic (bits/sec) (peak)”.............................................................................25
Using “Interface – Traffic (bits/sec) (pos/neg)”........................................................................25
Using “Interface – Traffic (bits/sec) (pure LINE)”...................................................................26
Convert to AREA/STACK Graph, No Totals, No Reordering.............................................26
Convert to AREA/STACK Graph, Print totaling Legend Items Only, Total Similar Data
Sources, No Reordering.......................................................................................................27
Caveats...........................................................................................................................................29
A Word on CDEFs.........................................................................................................................30
Totaling CDEFs.........................................................................................................................31
Make 0 CDEF...........................................................................................................................32
Caveat when using different Graph Templates..............................................................................33
Page 2 of 33
The Cacti Group
Aggregate Plugin Version 0.75
Usage Guide
FEATURES
The AGGREGATE plugin was developed based on a HowTo from user Linegod (J.P.
Pasnak). The main purpose is to reduce the amount of manual tasks required to create a
new graph based on two or more already existing graphs: an aggregated graph.
So, basically, it does nothing magic; you can't do it all on your own. In fact, all graphs
created by AGGREGATE are by all means normal Cacti graphs. You may place them
into any tree, you can modify them, add new items, rename title or items.
Here's a brief list of all supported features:
● Suggest a new title based on the basic graph template, removing unwanted |query_*|
and |host_*| stuff (|query_*| supported for data query type graphs only)
● Allow for |host_*| and |query_*| variables in AGGREGATE graph item text field
(|query_*| supported for data query type graphs only)
● Graph item prefix defaults to |host_hostname| to distinguish graph items of different
hosts
● optionally convert to AREA/STACK type graphs using sophisticated graph item
type conversion
● optionally convert to all available LINEx graph item types
(as Cacti does not yet support stacked LINEx, this is not supported by
AGGREGATE as well. Cacti 0.8.8 will support all available RRDTool LINEx
types)
● Support for Color Templates, e.g. all green “traffic_in” colors can be changed from
light to dark green to make them visually distinguishable
● Color rotation: in case a color template holds less items than the aggregate, the color
template will be applied multiple times
● programmatically add <HR> (line breaks) to avoid unwanted “concatenation” of
graph items
● Support a “sort order”, especially required if base graph is AREA/STACK type to
group similar graph items (e.g. all “traffic_in” first, all “traffic_out” next)
● Support for Totalling, either for “similar” or “all” data sources
this feature auto-creates new CDEFs when necessary
● custom prefix on total GPRINTs
● Support “total only” aggregates, not printing the “elementary” graph items
Page 3 of 33
The Cacti Group
Aggregate Plugin Version 0.75
Usage Guide
CAVEAT:
Please make sure not to leave old „aggregate“, e.g. <path_cacti>/plugin/aggregate_old!
Activating this plugin depends on the Plugin Architecture (PIA) used., please go to that
menu item, install and enable the new plugin.
Select the “Install” knob, then then „Enable“. It should now look like
Page 4 of 33
The Cacti Group
Aggregate Plugin Version 0.75
Usage Guide
Page 5 of 33
The Cacti Group
Aggregate Plugin Version 0.75
Usage Guide
Page 6 of 33
The Cacti Group
Aggregate Plugin Version 0.75
Usage Guide
BASIC USAGE
Now, turn to Graph Management. It makes sense to apply a search filter and/or a graph
template filter. Then, you will have to select the graphs you want to aggregate.
CAVEAT:
Please only select graphs based on a single graph template (see column „Template
Name“). If you fail to do so, AGGREGATE will throw an error!
Page 7 of 33
The Cacti Group
Aggregate Plugin Version 0.75
Usage Guide
Clicking for help opens this pdf file. Let me have some words on the quite complex
data on that screen. On the upper left, you'll see the list of graphs selected previously.
Please verify, that all needed graphs are included.
On the upper right, please notice the list of related data sources. The sequence may
deviate from the graph list. Don't bother to see the same IP in this example, both graphs
relate to my laptop's traffic.
The Title is pre-filled. The prefix always is „Aggregate“. Next comes the title taken
from the first graph in raw format, but having all |host_*| or |query_*| removed as
neither host nor query related variables make much sense for an aggregate . That is e.g.
„|host_description| - Traffic - |query_ifDescr|“ turns to “ - Traffic” only. Of course, you
will want to make it more meaningful to you.
Page 8 of 33
The Cacti Group
Aggregate Plugin Version 0.75
Usage Guide
Prefix allows you to distinguish graph items on the aggregate. Imagine aggregating
traffic, like this example does, without it you won't be able to distinguish between all
those aggregated graph items. You may discard the prefix, though. It is allowed, to use
all available |host_*| variables here and/or any plain text you like. When using a data
query, |query_*| type variables are allowed, too. Pay attention not to spend too many
characters in order to avoid line wrap of the legend.
Graph Type is quite important to use. You may wonder why it is defaulted to create
AREA/STACK graphs. Here's the reason why: Assume, you're aggregating an AREA
graph. Without STACKing the second, third, ... graph item, all of them will overlap.
Thus, only the last one will be seen (and perhaps parts of previous ones, if their values
are higher).
● “Keep Graph Types” does not change any graph type at all
● “Convert to AREA/STACK Graph” keeps type of first graph as is. But for the next
graphs, the graph type will be changed to AREA/STACK if it has been AREA or
LINEx.
● “Convert to LINEx Graph”: Sometimes, it is recommended to have LINEx graphs
instead. This will convert all graph types (AREA, STACK, LINEx) to the chosen
LINEx (x=1,2,3).
CAVEAT:
It is recommended to change the standard Graph Template for „Traffic“. Please switch
e.g. Traffic OUT to the negative y-axis. Else, Traffic IN and Traffic OUT will overlap
on the positive y-axis (see Chapter “Modifying the Default Traffic Graph Templates“
below!
Page 9 of 33
The Cacti Group
Aggregate Plugin Version 0.75
Usage Guide
Prefix for GPRINT Totals allows you to define a prefix to be printed in front of the
totaling line of the legend. The field is editable only if any “Totaling” option has been
chosen. Of course, you may change that prefix.
● for “Total Similar Data Sources”, the default is “Total”,
● for “Total All Data Sources” it is “All Items”.
Page 10 of 33
The Cacti Group
Aggregate Plugin Version 0.75
Usage Guide
Graph Templates Items is build based on the first graph selected, showing up in the
lower part of the aggregate screen.. Please pay attention to this section to make the most
of your new aggregate.
Page 11 of 33
The Cacti Group
Aggregate Plugin Version 0.75
Usage Guide
CAVEAT:
It is recommended to check required items! It is NOT sufficient to simply check the
totaling options in the upper half.
CAVEAT:
When using Total All Data Sources, it makes no sense in most cases to check more
than a “single set” of data sources. E.g. on a traffic graph, it's ok to select “input traffic
items” only. In case you check “output traffic items” as well, you will get two totaling
lines showing the same data: “total all data sources”.
For the totaling items, Prefix for GPRINT Totals is always used instead of Prefix to
prepend the legend line.
Totaling Similar Data Sources creates e.g. a total of each different data source referred
to in the graph. E.g. In this example, there are two: „Traffic In“ and „Traffic Out“. So
you want to check at least the AREA/LINEx graph items and all additional GPRINT
items.
But when using e.g. 95th percentile graphs or bandwidth COMMENTs, you will want to
skip them on the total.
Please see examples below for more.
Page 12 of 33
The Cacti Group
Aggregate Plugin Version 0.75
Usage Guide
Please apply this CDEF to the outbound traffic item and make it an AREA as well:
Page 13 of 33
The Cacti Group
Aggregate Plugin Version 0.75
Usage Guide
Now, one more tweaks is required for the template itself. The default auto-scaling
option does not allow for negative numbers to be plotted on the graph. That's why we
now switch to –alt-autoscale (ignore given limits). See
Page 14 of 33
The Cacti Group
Aggregate Plugin Version 0.75
Usage Guide
You may want to apply those changes to all traffic graph templates using bits. That
makes
● Interface - Traffic (bits/sec)
● Interface - Traffic (bits/sec, 95th Percentile)
● Interface - Traffic (bits/sec, Total Bandwidth)
Page 15 of 33
The Cacti Group
Aggregate Plugin Version 0.75
Usage Guide
The same applies to the “template” filter. You may argue, that all aggregated graphs
stem from the same basic graph template, expecting the aggregated graph to be related
to that very graph template as well.
But hold on: The new aggregate will have many more graph items, and, if you want,
even totaling items that have not been present at all. That's why it is not possible to
associate it with any existing graph template.
In fact, if you want to search by template, you will again have to set the template filter
to “None”:
Page 16 of 33
The Cacti Group
Aggregate Plugin Version 0.75
Usage Guide
COLOR TEMPLATES
When adding some graph items of same type, e.g. “traffic_in” and “traffic_out” to a
single aggregated graph, it makes sense not to use a single color for all graph items of
same type.
E.g. instead of using green (RGB x'00FF00) for “traffic_in”, you may want to associate
colors from light green to dark green. That's what a Color Template is used for.
Hit “Create” and “Add” new “Color Template Items”, one by one:
Page 17 of 33
The Cacti Group
Aggregate Plugin Version 0.75
Usage Guide
Page 18 of 33
The Cacti Group
Aggregate Plugin Version 0.75
Usage Guide
AGGREGATE COOKBOOK
Page 19 of 33
The Cacti Group
Aggregate Plugin Version 0.75
Usage Guide
Page 20 of 33
The Cacti Group
Aggregate Plugin Version 0.75
Usage Guide
Page 21 of 33
The Cacti Group
Aggregate Plugin Version 0.75
Usage Guide
Page 22 of 33
The Cacti Group
Aggregate Plugin Version 0.75
Usage Guide
Examples
Keep graph types, print all legend items, total similar data sources, reorder
Base graph is Interface – Traffic (bits/sec) ( default) on page 20. The aggregate shows
the same host twice, once named “gandalf-wlan” and once “localhost (127.0.0.1)”.
This examples shows two features:
● Totaling “Similar Data Sources”, printing all legend items
● Reordering by data sources
First, all items are added to the new aggregate graph. In this example, the graph types
are kept (AREA and LINE1, respectively)
Then, the total is build; in this case “Total Similar Data Sources”, both for inbound and
outbound traffic. The total is drawn as a line (hard to notice on this graph).
At last, the reordering takes place. So all inbound items are grouped and all outbound as
well.
Page 23 of 33
The Cacti Group
Aggregate Plugin Version 0.75
Usage Guide
shows the same host twice, once named “gandalf-wlan” and once “localhost
(127.0.0.1)”.
When using a base graph of type Interface – Traffic (bits/sec) (AREA/STACK) without
conversion (“Keep Graph Types”), the result is
In fact, that graph consists of AREA and STACK only. But as explained in Caveats on
page 29, both AREAs do overlap. It is very likely that this won't make you happy.
You will get a different result, when using “Convert to AREA/STACK graph”, even if
this sounds weird. This conversion option will sweep the resulting graph, keeping a
single AREA only and converting the rest to STACK.
The result may look better than the first one
Page 24 of 33
The Cacti Group
Aggregate Plugin Version 0.75
Usage Guide
Page 25 of 33
The Cacti Group
Aggregate Plugin Version 0.75
Usage Guide
( default)” on page 23. You will expect a quite similar result. And yes, the only
difference is that the output related data is drawn on the negative y-axis. Even the
totaled output LINEx is automagically printed on the lower half.
Illustration 24: Convert to AREA/STACK Graph, Print all Legend Items, Total Similar
Data Sources, Reorder
Page 26 of 33
The Cacti Group
Aggregate Plugin Version 0.75
Usage Guide
Convert to AREA/STACK Graph, Print totaling Legend Items Only, Total Similar Data
Sources, No Reordering
This example shows a “totaling only” aggregate. Especially when aggregating many
items, the legend may rise and the graph area may look confusing.
The option to use is “Print Totaling Legend Items Only”. This will not draw the basic
items used for the aggregate.
Illustration 26: Convert to AREA/STACK Graph, Print totaling Legend Items Only,
Total Similar Data Sources, No Reordering
This graph seems to include too many items. You are expecting to find totaling items
only, do you?
But this won't work. “Total Similar Data Sources Nodups” requires, that the items to be
Page 27 of 33
The Cacti Group
Aggregate Plugin Version 0.75
Usage Guide
totaled are present! AGGREGATE therefor does not skip them. It uses the “MAKE 0”
CDEF to suppress the data that would else be printed on the graph area.
As a conversion too AREA/STACK is requested, the totals are printed as STACKs.
Those STACKs are based on the first AREA, that has been CDEFed to 0. All in all you
get what you want.
Page 28 of 33
Caveats
Here's a small compilation of selectable parameters that won't make sense due to various reasons mentioned below.
No. Graph Type Conversion Totaling Total Reordering Remarks
Type
1 AREA + LINE Keep Graph Any Any Any AREAs overlap; e.g. only last AREA may be visible
Types
2 Any Any Print totaling Any Any Reordering has no visible effect when totaling entries are the
Legend Items only one printed.
Only
3 AREA + STACK Keep Graph Any Any by data source Two or more AREAs will appear; they again will overlap. The
Types STACKed items will be stacked onto the last AREA, not onto
the “related” AREA. This is how RRDTool works.
4 AREA + STACK Keep Graph Print all Any by data source At least one totaling LINE1 will drawn in between normal
Types Legend Items entries. All STACKed entries shwoing up after this totaling
LINE1 will be stacked onto that very LINE1, not onto the
“related” AREA.
5 AREA, STACK + Convert to Print totaling Any No This type of graph is e.g. used when graphing AVERAGE and
LINEx AREA/STACK Legend Items MAX in one template. The conversion will change the LINEx
Only to STACK which may not be what you want. Consider using
conversion type “Keep Graph Types”
6 AREA (pos) + Keep Graph Any but “Print Any Any AREA is drawn on positive and negative y-axis. Without
AREA (neg) Types totaling conversion of graph type, the AREAs will overlap; see item 3.
Legend Items When “Print totaling Legend Items Only” is chosen, this may
Only” still make sense.
The Cacti Group
Aggregate Plugin Version 0.75
Usage Guide
A Word on CDEFs
Well, until now everything seems to be quite straightforward. CDEFs were already
mentioned in Chapter “Modifying the Default Traffic Graph Templates“. What's wrong
with them?
When aggregating graph items, this is more or less beading them one after another,
mostly just as they are in the selected graphs. Then, there is some color magic, skipping
code, prefixing text and <HR> stuff.
But totaling is worse, much worse. The graph items themselves do not require any
change. But the totaling line requires a CDEF that holds something like
“TOTAL_ALL_DATA_SOURCES_NODUPS” or
“SIMILAR_DATA_SOURCES_NODUPS” where currently
“CURRENT_DATA_SOURCE” is listed.
So this plugin generates new CDEFs. It fetches the CDEF from the original graph item
and resolves it to plain text. Then, depending on the totaling action selected,
“CURRENT_DATA_SOURCE” is replaced by the totaling magic required.
Now we have a new CDEF. To avoid storing duplicate CDEFs, all existing CDEFs now
are scanned and compared to the new CDEF. On match, the existing CDEF is used. If
no match is found, the new CDEF is stored.
The title of the new CDEF is taken from the original CDEF, but a string is prepended.
Either “_AGGREGATE ALL “ or “_AGGREGATE SIMILAR” is used to distinguish.
The underscore is used for sake of sorting them to the bottom of the CDEF list.
This is a list of all CDEFs on my system after quite a lot of aggregation:
Page 30 of 33
The Cacti Group
Aggregate Plugin Version 0.75
Usage Guide
Totaling CDEFs
CDEF Title CDEF
_AGGREGATE ALL Turn Bytes into Bits ALL_DATA_SOURCES_NODUPS,8,
_AGGREGATE ALL Turn Bytes into bits, ALL_DATA_SOURCES_NODUPS,8,*,-1,*
make negative
_AGGREGATE SIMILAR Multiply by -1024 SIMILAR_DATA_SOURCES_NODUPS,-
1024,*
_AGGREGATE SIMILAR Multiply by 1024 SIMILAR_DATA_SOURCES_NODUPS,1024,
*
_AGGREGATE SIMILAR Turn Bytes into Bits SIMILAR_DATA_SOURCES_NODUPS,8,
_AGGREGATE SIMILAR Turn Bytes into bits, SIMILAR_DATA_SOURCES_NODUPS,8,*,-
make negative 1,*
Page 31 of 33
The Cacti Group
Aggregate Plugin Version 0.75
Usage Guide
Make 0 CDEF
Another special CDEF is the “Make 0” CDEF. When you want totals only, we need a
special treatment of “original data source” that you don't want to see.
For the totaling magic, you will need the “DEF” statements created by cacti when using
the “original data source”. But you don't want to have them printed. This sounds like an
inconsistency. Butt it can be resolved by applying a CDEF that renders all data to 0.
This can be achieved by
CDEF Title CDEF
_MAKE 0 CURRENT_DATA_SOURCE,0,*
Page 32 of 33
The Cacti Group
Aggregate Plugin Version 0.75
Usage Guide
In this example, I purposely made a mistake. The result screen will be as follows
Page 33 of 33