<< Previous Section How Templates Will Save You Time [home] Next Section >>

Data Templates

Creating a data template is very similar to creating a new data source as you will see. To create a new data template, select "Data Templates" under the "Templates" heading and click "Add".

The first thing you must do is give the template a name. This name has nothing to do with the data source name, but is what you will use to identify the template throughout Cacti. Second, you will notice a list of data source/data source item field names with Use Per-Data Source Value checkboxes next to each one. The nice thing about templates in Cacti is that you can choose whether to template each field on a per-field basis. If you leave the checkbox unchecked, every data source attached to the template will inherit its value from the template. If the checkbox is checked, every data source attached to the template will contain its own value for that particular field.

Note: For most data templates, you will want to check the Use Per-Graph Value checkbox for the name field so each data source using this template has its own unique name. It also makes sense to enter an inital value in this field that includes the variable |host_description| for organizational purposes.

Note: For data templates, the "Data Input Source" field will always be part of the template. Checking or unchecking the Use Per-Data Source Value checkbox will have no effect on this field.

When you are finished filling in values for the data template, click "Create" and you will be presented with a screen similar to the data source edit screen.

Assuming you selected a data input source on the previous screen, you should now be presented with a "Custom Data" box. Each custom data field is per-field templatable as all of the other data source fields are. Even if you select the Use Per-Data Source Value checkbox, it might be useful to specify a value that will be used as an "inital value" for any data source using this data template.

Applying Data Templates to Data Sources

Applying a data template to a data source is a very simple process. The first thing you must do is select the data source you want to apply the template to under "Data Sources". Under the "Data Template Selection" box, select the data template that you want to apply to the data source and click "Save".

Once the template is applied to the data source, you will notice that you can only change values for the fields that you checked Use Per-Data Source Value for.

Now any time a change is made to the data template, it will be automatically propagated to the data sources attached to it.