How-to use scripts to create cacti templates

If you have ever created a cacti templates from scratch, you would know it’s a very tedious work. I am very lucky to find this site. Later it moved to this new place. There are plenty of documents to let us know how it works while I will just share my experience of creating an MongoDB template.

First, create a definition file.

It can be copied from an existing one and change it. Referenceand.

You may need to unique the hash value using this script.

tools/ >
tools/  --refresh >

Secondly, generate the cacti template.  --mpds port2 --script /export/home/cacti/scripts/ss_get_mongo_stats.php > mongo.xml

Here are the source files(you need to change the file extension name back after download): : this one need to be created manually. It’s not so difficult if you know the structure. : I added the support of “friend name” to it.
ss_get_mongo_stats.php : this one is changed from ss_get_by_ssh.php. One of the outstanding changes is the change to the map array as follows:

<pre>$keys_map = array(
   'MONGODB_connected_clients'            => array('short' => 'ma',  'source' => 'Connections'),
   'MONGODB_active_sessions'              => array('short' => 'mb',  'source' => 'Active'),
   'MONGODB_used_resident_memory'         => array('short' => 'mc',  'source' => 'residentMem'),
   'MONGODB_used_mapped_memory'           => array('short' => 'md',  'source' => 'mappedMem'),

The performance data is from a webpage like:


As always, it’s just an example to help you get started. You can change whatever you like once you know it.

About Alex Zeng
I would be very happy if this blog can help you. I appreciate every honest comments. Please forgive me if I'm too busy to reply your comments in time.

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 )

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: