3/11/2015

RRD, Making Cacti Graph

Cacti is a modest PHP website app for creating and hosting pages of continuously updated graphs using SNMP, WBEM or Script data stored in RRD databases. Here's how to do that.

After logging into the main website:

A landing page presents a Tools menu down the Left side and a Modules or Apps menu at the top







Structurally a Graph begins with a registered Device. Registering it assigns it a Host Template, which assigns a default set of Data Queries and Graph Templates.

Begin by clicking "Devices" in the Tool menu then "Add":





Register a Device by minimally providing 4 pieces of information, then click "Create":

Ideally a "Host Template" will already exist for this Device, if one does not select "None" then create the device.




If there wasn't a Host Template for the Device, take a detour and create a new Host Template from existing Data Queries and Graph Templates and return to Edit the new "Device" and assign it the new Host Template and Save the change.

Create a new Host Template by clicking Host Templates in the Tool menu then "Add":


Create a new Host Template by providing a "friendly" name for it, then click "Create":



Ideally suitable "Data Queries" and "Graph Templates" will already exist and can be "Added", if they do not exist, make another set of detours to create them, then Edit this Host Template and choose to "Add" them to this Host Template and Save.


To create a new "Data Query"

Begin by clicking "Data Queries" in the Tool menu then "Add":




Then provide minimally 3 pieces of information, then click "Create":




The XML query file will have a  "Data Source Name" for each of the values returned by a "Data Query". SNMP (Indexed) Data Queries use the oid addresses in the XML query file to find a table and its fields and retrieve the values from the SNMP agent on a device.



A "Data Template" will describe how to store the "Data Source Name" values as "Data Source Items" in an RRD database as a "Data Source". 




Additional "Data Source Items" can be added by clicking "New" (the default "Data Source Name" will appear as 'ds' until it is overwritten or changed and the template is Saved). More than one "Data Source Name" will appear as a new Horizontal tab above the "Data Source Item" edit section.

Old "Data Source Items" can be modified by selecting their tab.

[warning] > once a "Data Template" has [Created] space for the "Data Source Items" in the RRD database files. The RRD files are not changeable. The "Data Template" can be modified but changes in the RRD files will not occur. The only way to redefine the RRD files (to remove or add more "Data Source Items") is to delete the Data Template and the RRD files and start over. This means any data stored in the RRD files will be lost.


To create a new "Data Template"

Begin by clicking "Data Templates" in the Tool menu then "Add":






Then provide minimally 3 pieces of information, then click "Create":

Continue by clicking "Add" in the "Data Source Items" section

A "Graph Template" will describe how to create a graph background and then graph items to put on to the background as layers on top of each other.

A "Graph Item" is added to a "Graph Template" by selecting a "Data Source" which is a compounded name formed by the "Data Template" name in which a "Data Source Name" is declared a "Data Source Item" then a hyphen and then the "Data Source Item" in parenthesis, i.e. DataTemplate - (DataSourceItem)


Begin by clicking "Graph Templates" in the Tool menu then "Add":





Then provide minimally 3 pieces of information, then click "Create":



Continue by clicking "Add" in the "Graph Items" section

Finally, [Associate] both "Data Queries" and "Graph Templates" to the new "Host" template

Then return to the "Devices" Tool menu, select the new "Device" and change its "Host Template" from [NONE] to [new Host Template] scroll to the bottom and click Save.


The new Data Queries and Graph Templates will added to the new Device

Click [Create Graphs for this Host] select a [Graph Template] and [Data Query] and check a box next to the [Data Source Item] to be graphed, then click "Create" to Save