Cacti provides a facility to create templates for data, graphs, and hosts. This chapter is going to explain how to create these templates and apply them to the devices.
This chapter is going to cover the following topics:
- An introduction to templates
- Defining a data template
- Defining a graph template
- Defining a host template
- Assigning a host template to a device
- Importing/exporting templates
- References to the template repository
So let's get started…
Cacti has templates which can be used to simplify the process of creating and administering graphs, as well as assigning them to specific types of hosts. There are three different types of templates: graph, host, and data.
Data templates describe the data which Cacti is going to store in the RRD files. This basically comes down to the RRDtool create
command. Having a template for the RRDtool create
command issued internally by Cacti assures you that RRD files based on this template are always created in a common way.
Please note that once a data template is being used to create an RRD file, changes to the data template will not be reflected on that RRD file.
Graph templates define the look and feel of a graph. They also provide the skeleton to the RRDtool graph function, defining the data sources to use and the graph items to display. Changes to a graph template get propagated to all graphs based on that template.
Host templates are like shopping baskets for graph templates and data queries. Let's assume a specific device type should contain several different graphs. Instead of adding each single graph template and data query to each single device, you can simply define these within a host template and assign that host template to the device.
Unfortunately, changes to a host template do not get propagated down to the single devices.
We just heard about "Data Queries", but what is it? A data query is a special way of retrieving indexed data such as a list of network interfaces or running processes on a Linux server. It consists of an XML file defining the location of the data to be retrieved and the actual method for retrieving it. In addition to the XML file, a data query also needs to be defined in Cacti in order for Cacti to map the data to an associated graph template.