Files
Cactidocumentation/How-To-Work-With-Templates.md
T
Thomas Vincent 741ad51355 docs: [1.2.x] refresh the front page, correct grammar and Markdown, and align plugin pages with their READMEs (#273)
* docs: [1.2.x] refresh the manual front page

The front page opened with version notes before saying what Cacti is,
used headings as sentences in the credits, and its table of contents
listed seven sections while the page has ten.

Open with a short description and a getting-started sequence, link the
website and forums, give the credits real headings, and list every
section in the table of contents in page order. Record Jeff Pasnak
under In Memoriam with a link to the 1.2.31 release announcement.
Correct label typos and wrap long entries with reference links.

Existing section anchors are unchanged, and every page is still linked.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* docs: [1.2.x] fix typos, unrendered headings and forum links

A check of every page linked from the front page found misspellings in
eleven pages, three Mactrack headings written without a space after the
hashes, which render as plain text, and two forum links still using
http.

Correct the spellings, add the missing space so the headings render,
and point the forum links at https, where they already redirect.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* docs: [1.2.x] align the plugin pages with the plugin READMEs

The supported plugins list and the Syslog and Mactrack pages had drifted
from the README and INFO files in the plugin repositories.

Update the descriptions that the READMEs contradict: Monitor's Thold
requirement, the Router Configs transfer methods, the ReportIt release
and Cacti versions, the WMI collection methods and its development
status, and NUT support in Apcupsd. Add the Syslog requirements, the
upgrade procedure, the dedicated database settings and the remote
collector settings, and correct the database grant and a misplaced
code fence. Add the Mactrack requirements and a short section on
history partitioning and ignored ports that links to the README.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* docs: [1.2.x] correct grammar, spelling and broken Markdown

A read of every page linked from the front page found grammar and
spelling errors throughout, and Markdown that does not render as
intended.

Correct grammar, spelling, punctuation and product-name capitalization
in 95 pages without changing headings, code blocks, link targets or
the meaning of the text. Repair the Markdown defects: a code fence in
the SSH tunnel how-to that never closed, malformed bold markers in the
user management and device defaults pages, a release notes table with
no blank line before it, split rows in the tree sorting table, and
LDAP list items missing their markers. Correct three interface labels
quoted with typos.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

* docs: [1.2.x] correct statements that differ from the 1.2.x source

Reviewers of the linked pages flagged statements that looked wrong.
Each was compared with the Cacti 1.2.x source at 1523aa04b, and only
those the source or the page itself settles are changed.

Correct interface labels and option names (Index Count Changed,
Permissive, Not Selected, Utilities, the BCC description, the gear
icon for plugin install), the default Maximum Value of U for a new
data source item, the sysDescr object name, the PHP floor wording in
the requirements table, the Mactrack wildcard character and the
snmptrapd -On option. Repair cross-references, example values that
disagree with their commands, two table captions, a split list and
several sentences with missing words.

Statements the source does not settle are left as written.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>

---------

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
2026-11-24 00:58:06 -08:00

6.3 KiB

How To Work with Templates

We will follow the following process in this example:

  • Create Data Template - Defines how we store the data in the RRDfile
  • Create Graph Template - Defines how we graph the data in the RRDfile
  • Device Template - Defines which Graphs to associate with a Device Type

Data Template Creation

For this task, let's stick to SNMP stuff. For you to be able to reproduce this example, I've chosen the UDP information of the IP MIB.

snmpwalk -c <community string> -v1 <device> udp
UDP-MIB::udpInDatagrams.0 = Counter32: 7675
UDP-MIB::udpNoPorts.0 = Counter32: 128
UDP-MIB::udpInErrors.0 = Counter32: 0
UDP-MIB::udpOutDatagrams.0 = Counter32: 8406

As Cacti does not use the MIBs but pure ASN.1 OIDs, let's search the OID used as udpInDatagrams:

snmpwalk -c <community string> -v1 -On <device> udp
.1.3.6.1.2.1.7.1.0 = Counter32: 7778
.1.3.6.1.2.1.7.2.0 = Counter32: 129
.1.3.6.1.2.1.7.3.0 = Counter32: 0
.1.3.6.1.2.1.7.4.0 = Counter32: 8514

The needed OID is .1.3.6.1.2.1.7.1.0. Now learn how to enter this into a new Cacti Data Template: Please proceed to Data Templates and filter for SNMP. Check the SNMP - Generic OID Template.

Data Templates

After clicking Go, you're prompted with a new page to enter udp/net - udp In Datagrams as the Title Format for the new Data Template:

The screenshots are from an older example; follow the names and OIDs in this text for each copy.

Data Templates Duplicate

Due to the filter defined above, you won't see the new Template at once, so please enter udp In as a new filter to find:

Data Templates New

Edit the copy for udpInDatagrams, using OID .1.3.6.1.2.1.7.1.0, a recognizable internal name such as udp_in, and the COUNTER data-source type. The historical screenshots show the field locations and mix older labels. Use the name/OID pair above for the inbound copy, then udpOutDatagrams and .1.3.6.1.2.1.7.4.0 for the second, outbound template:

Data Templates New 1

Data Templates New 2

Data Templates New 2

Set Maximum Value to U for no upper limit, as shown in the screenshot. Do not use 0: with the illustrated minimum of 0, Cacti rejects that range. Use a finite upper limit only when it represents a valid bound for the metric. And you saw the OID .1.3.6.1.2.1.7.1.0 from above, didn't you? Please copy another one for OID .1.3.6.1.2.1.7.4.0, using the description udpOutDatagrams

Graph Template Creation

Now let's generate the Graph Template for those already generated Data Templates. Please go to Graph Templates and Add a new one:

Graph Template

Now you have to fill in some global parameters:

Graph Template New

and Create to see:

Graph Template New 3

Now let's add some Graph Template Graph Items. They will specify which Data Sources defined by some Data Template should be displayed on the Graph. Please click Add as shown on the last image:

Graph Template Items 1

Now click Save to see the resulting image below. Note that both the Graph Item and the Graph Item Input have been created.

Graph Template Items 1

Next, we have to add a Legend in order for people viewing the Graph in the future to obtain numeric data about the Graph contents. We will create a very simple one, though Graph Legends can be a very complex subject.

To add the Graph Legend, simply press the Add button again and fill out the Graph Item as shown in the image below. You should note that for this second Graph Item, it remembered the previous Data Source.

Graph Template Items

Press Save to see three legend items created in one step!

Graph Template Items 2

Now we could have continued to add the UDP Datagrams In by adding a second RRDfile Data Source to our Data Template, but we will skip that for this exercise and continue now that our Graph Template is reasonably completed.

At this point, since we only added Graph Items to the Graph Template, there is no need to resave it at this point. We can simply continue to the next step.

Now, you may add this new Graph Template to any Devices that respond to the udp OID we specified in the Data Template. But in this case, please wait a moment. Let's first proceed to the Device Template and use this new Graph Template for our first own Device Template.

Device Template Creation

The next task is to create a new Device Template. So, select Device under Console > Templates and press the Add button as in previous examples. When you do that, you will be presented with a page that resembles the one below.

Add Host Template

and fill in the name of this new Template:

Add Host Template New

Now you'll find two sections added. First, let's deal with Associated Graph Templates. The Add Graph template select drop-down contains all existing Graph Templates. In the images, you will see that we are creating a Device Template for a NetApp Filer and adding some common Graph Templates and Data Queries from the Cacti built-in collection.

This is a custom device-template example. Cacti 1.2.31 does not bundle a dedicated NetApp package. Reusing built-in graph templates does not establish NetApp-specific metric support; verify the objects the device exposes before adding graphs or queries to the template.

Host Template Associate Graph Template

and Add it:

Host Template Associate Graph Template 2

Next, let's add the Data Query already selected above:

Host Template - Data Query

Keep in mind, this is one of the more simple Template examples. Topics such as Data Queries, Data Input Methods, and Script Server add a few steps to the Template creation process.


Copyright (c) 2004-2026 The Cacti Group