How To How to Graph a Custom Collection Script

This HOWTO walks you through the simplest steps of graphing the output of a single value from a script. As a new user of cacti, I had a difficult time understanding how to graph anything that wasn't canned with the original load. After a lot of playing around, I came up with these procedures which can be built upon for more sophisticated collections and graphs.

I do not use templates in this HOWTO. Templates provide a significant advantage if you are graphing the output for multiple instances or creating graphs for multiple hosts. They help to maintain consistency and simplify setup.

The example here is not realistic, but can be used and expanded upon as a model for creating your own graphs.

I've not put a lot of explanations in the procedures. Refer to the Cacti manual for more details.

Have a tested script ready to go. I used the following script located in /home/cactiuser/bin called random2.pl:

#!/usr/bin/perl -w

print int(rand(10));

This script simply prints out a random integer between 0 and 9 every time it's called.

Minimal steps to create a graph from a script

  1. Create a Data Input Method to tell Cacti how to call the script and what to expect from it.

  2. Create a Data Source to tell Cacti how and where the data will be stored.

  3. Create a Graph to tell Cacti how the data will be presented in graph form.

  4. Add Graph to Graph Tree so you can view the graph.

  5. View the Graph.

Detailed Instructions

  1. Create Data Input Method

  2. Create a Data Source

  3. Create Graph

  4. Add Graph to the Graph Tree

  5. View Graph


Originally written by Kevin der Kinderen, http://kdeuja.com/~kevin/

Copyright (c) 2004-2020 The Cacti Group