Cacti (home)ForumsDocumentation

Basics

Principles of Operation

The image below shows the building blocks of a Cacti infrastructure: Functional Scheme

Administration and usage is done via browser. When defining new Graphs and Templates and stuff, you log into the Cacti web pages. All administrative data will be stored in MySQL tables. On the same server, you'll find the poller. The poller will query the given target systems, be it a router, PBX, server or application. Results fetched from those targets are stored in rrd files. Cacti will use those rrd data to create nice graphs, then.

Cacti operation may be divided into three different tasks:

Principles of Operation

Data Retrieval

First task is to retrieve data. Cacti will do so using its Poller. The Poller is executed from the operating system's scheduler, e.g. crontab for Unix flavored OSes.

In current IT installations, you're dealing with lots of devices of different kind, e.g. servers, network equipment, appliances and the like. To retrieve data from remote targets/hosts, cacti will mainly use the Simple Network Management Protocol SNMP. Thus, all devices capable of using SNMP will be eligible to be monitored by cacti.

Later on, we demonstrate how to extend cacti's capabilities of retrieving data to

Data Storage

There are lots of different approaches for this task. Some may use an (SQL) database, others flat files. Cacti uses RRDTool to store data.

RRD is the acronym for Round Robin Database. RRD is a system to store and display time-series data (i.e. network bandwidth, machine-room temperature, server load average). It stores the data in a very compact way that will not expand over time, and it can create beautiful graphs. This keeps storage requirements at bay.

Likewise, rrdtool will perform some specific tasks. It performs consolidation to combine raw data (a primary data point in rrdtool lingo) to consolidated data (a consolidated data point). This way, historical data is compressed to save space. rrdtool knows different consolidation functions: AVERAGE, MAXIMUM, MINIMUM and LAST.

Data Presentation

One of the most appreciated features of RRDTool is the built-in graphing function. This comes in useful when combining this with some commonly used webserver. As such, it is possible to access the graphs from nearly any browser on any platform.

Graphing can be done in very different ways. It is possible, to graph one or many items in one graph. Autoscaling is supported and logarithmic y-axis as well. You may stack items onto another and print pretty legends denoting characteristics such as minimum, average, maximum and lots more.

Cacti

Cacti glues all this together. It is mainly written in php, a widely-used general-purpose scripting language that is especially suited for Web development and can be easily embedded into HTML.

Cacti provides the Poller and uses RRDTool for Storage and Graphing. All administrative information are stored in a MySQL database.

Cacti to RRDTool Translation Table

When using cacti, be it with or without current rrdtool knowledge, you may become confused by all those technical expressions. Let's try to translate

Cacti NotationRRDTool NotationUsage
Data Template structure of an rrd file Used to define the structure for storing data
This Template will be applied to specific hosts to create real RRD files
Data Source Item
as part of a Data Template
data source (ds) A RRD file may hold data for more than one single variable.<br>Each one is named “data source” in RRDTool lingo
Data Source
as a real instantiation of a Data Template when applied to a Device
RRD file Yep, this is an ugly one
When a Data Template is created, Cacti names it “Data Source”.
RRDTool says it's an RRD file
Graph Template structure of an rrdtool graph statement Used to create a “raw rrdtool graph statement”
This Template will be applied to specific hosts to create real RRD graphs
Graph Template Item
as a part of a Graph Template
graph element This is a complex one. Each item will create parts of an RRDTool graph statement. Typically, this will include
  • the (reference to the) DEF needed,
  • LINEx/AREA/STACK along with a color for graph elements or
  • GPRINTs for legends,
  • (reference to a ) CDEF and
  • textual elements
Graph
as a real RRDTool graph statement, created when applying a Data Template to a Device
RRDTool graph statement Whole statement, including all options and graph elements


Some words on rrdtool lingo

keywordmeaning
step A time-variable data in intervals of a certain length.
primary data point (PDP) The value for a specific step, that has been interpolated
consolidation function (CF) Used to conolidate multiple primary data points (PDPs). Typical consolidation functions are average, minimum, maximum.
consolidated data point (CDP) The result of multiple primary data points (PDPs) after having a consolidation function (CF) applied to them.
round-robin archive (RRA) Stores a fixed amount of CDPs and specifies how many PDPs should be consolidated in to one CDP and which CF to use.
round-robin database (RRD) A database that contains multiple RRAs.


rrdtool inner workings


Cacti graphs are stored in a round-robin database (RRD), also known as a circular buffer, thus the system storage footprint remains constant over time.

RRDtool assumes time-variable data in intervals of a certain length. This interval, usually named step, is specified upon creation of an RRD file and cannot be changed afterwards. Because data may not always be available at just the right time, RRDtool will automatically interpolate any submitted data to fit its internal time-steps.

The value for a specific step, that has been interpolated, is named a primary data point (PDP). Multiple primary data points may be consolidated according to a consolidation function (CF) to form a consolidated data point (CDP). Typical consolidation functions are average, minimum, maximum and last.

After the data has been consolidated, the resulting CDP is stored in a round-robin archive (RRA). A round-robin archive stores a fixed amount of CDPs and specifies how many PDPs should be consolidated into one CDP and which CF to use.

* In other words: Multiple primary data points (PDPs) can be consolidated using a consolidation function (CF) such as average, minimum or maximum. Once the CF has been performed, the result is known as a consolidated data point (CDP). This information is stored in an round-robin archive (RRA).

After this time the archive will “wrap around”: the next insertion will overwrite the oldest entry. This behavior is sometimes referred to as “round-robin” and is the reason for the program's name.

To cover several timespans and/or use several consolidation functions, an RRD file may contain multiple RRAs. The data retrieval function of RRDtool automatically selects the archive with the highest resolution that still covers the requested timespan. This mechanism is also used by RRDtool's graphing subsystem.

Graph Overview

Almost everything in Cacti is somehow related to a graph. At any time, you can list all available graphs by clicking on the Graph Management menu item. While it is possible to manually create graphs through this screen, new users should follow the instructions provided in the next chapter for creating new graphs in Cacti.

For users that are familiar with RRDTool , you will immediately recognize that a graph in Cacti is closely modeled after RRDTool's graphs. This makes sense since Cacti provides a user friendly interface to RRDTool without requiring users to understand how RRDTool works. With this in mind, every graph in Cacti has certain settings and at least one graph item associated with it. While graph settings define the overall properties of a graph, the graph items define the data that is to be represented on the graph. So the graph items define which data to display and how it should displayed, and also define what should be displayed on the legend.

Each graph and graph item has a set of parameters which control various aspects of the graph. Fortunately through the use of graph templates, it is not necessary to understand the function of each field to create graphs for your network. When you are ready to take on the task of creating your own graph templates, extensive field descriptions for both graphs and graph items are provided in that section of the manual.

At this point, you probably realize that graphing is Cacti's greatest strength. Cacti has many powerful features that provide complex graphing and data acquisition, some which have a slight learning curve. Do not let that stop you however, because graphing your network is incredibly simple.






Personal Tools