CACTI Template Hashes – What I learned.
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).
Version 0x21 of cacti
32-bit hash, random, unique.