Skip to content

CACTI Template Hashes – What I learned.

April 7, 2012

In keeping with the whole human knowledge belongs to the world idea, here’s a primer for creating CACTI templates using a CLI method that should enlighten and save hours and hours and hours.

Learned lesson:  Don’t fully use random 32 character MD5 for hash,  you’re bound to run into duplicates.  Drop the tail by 4 characters and append a universal counter++ ( 9999 unique serials using digits [0-9] ). Also, probably dropping another 2 characters somewhere and inserting a 2-digit hex job-batch number will also help avoiding duplicates in an installed system.

Here’s some code to generate hashes, but strict warning, hashes must be system-wide unique.  I urge you to use the code loosely, then chop the end off and add your own serial number.

Learned lesson: Data Source names must begin with a letter, not a number.  So if you’re going to define them in a calculated fashion, you must place a character in front.  Otherwise everything breaks.

Learned lesson: Cacti graph export is broken.  It is erroneously generating <items> hashes under <hash_090021>.  This led to crazy frustration when trying to figure out the templates, but you must map a data source to the graph item.

Learned lesson: the keys you provide to the script that creates the template (also used to name graphs, etc.) should never contain a “less-than” or “greater-than” ( < > ) sign, as this will screw up XML processing when you go to import the script.

Learned lesson: template files larger than 2 MB have either be copy and pasted into the import field text box, or you will have to modify the /etc/php5/apache2/php.ini file to allow uploads greater than 2M or POSTs greater than 8M (defaults).

Definition order and sub-order:










A whole bunch of cross-reference, but it’s easy to see how a template gets generated with one that is easy to study (for example, DNS_BIND stuff).


Template Hashes:

Syntax example:


Always there.

Item type

Version 0x21 of cacti

32-bit hash, random, unique.


Item types:

Graph 0000
Graph.item 1000
Graph.item.taskitemid 0800
Graph.item.gprintid 0600
Graph.input 0900
DS 0100
DS.datainputid 0300
DS.item 0800
DS.datainputfieldid 0700
RRA.item 1500
One Comment leave one →
  1. loglix permalink
    May 3, 2013 10:51 pm

    Hello, how do you update hashes on a template that has been developed on an older version of Cacti so that it matches with a more current version of Cacti ?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: