criggie.org.nz

News Images MP3 Humour Email Us Webmail Links
Poem Debbie Criggie Daniel Luke Katherine Gladys
Cacti Graph Creation

Creating Graphs in Cacti

I recently installed Cacti, a graphical/web based frontend to rrdtool. Is very pretty, but can be complex. Here's a walk-through howto for creating a graph based on a script.

Install Cacti

Cacti is probably packaged for your linux distro, or you can download the source from http://www.cacti.net/ Cacti depends on a functional MySQL installation and rrdtool.

Data Flow

The flow of data in cacti is complex - possibly more complex than it needs to be. However the complexity allows all sorts of separation, which makes implementing multiple copies of the same graph for different data easier.

  1. Scripts live in site/scripts/filename
  2. Data Input Methods tell cacti how to call a script - parameters to give and what values a script will return
  3. Data Sources are actual values to feed a Data Input Method and a RRD filename to store these returned values into
  4. Graphs are instructions on how to display values from a RRD file, which colours etc.
  5. Graph Trees are sets of graphs

Scripts

Here's a simple sample script to return the temperature of up tp four IDE hard drives, from smartctl.

#!/bin/bash
 
temp=0

for drive in $* ; do
    /usr/sbin/smartctl -a /dev/$drive | tail -n +8 | { while read id name flag value worst thresh type when blank raw; do
        case $name in
           Temperature_Celsius) temp=$raw ;;
        esac
    done

 echo -n "$drive:$temp "
}
done
echo 

The script returns values exactly this:

./check_smart_temp.sh hda hdb hdc hdd sda
hda:22 hdb:16 hdc:18 hdd:19 sda:22
rk In Progress. This is hard! PLACEHOLDER

Links

  • Diagnosing and debugging NANs in cacti graphs

    More details will be added over time. Any queries - email me from this mailer page


    This file last modified Friday July 14, 2017

    If you find something here useful, feel free to donate bitcoin: Donations address: 14LHst9s1UEh8NMem87qaEd9tJWSCiNt1x

    Valid HTML 4.01!

    .