I’ve been playing with Micromiser for a few days, and wanted to graph what it claims to be saving on one of the servers. Luckily this is pretty easy with Munin (which is already running on the box), since Micromiser logs into syslog occasionally. Below is the plugin I hacked together that looks at syslog and uses sed to extract the percentage saving. It’s not pretty, but it does work.

Perhaps this’ll save you a few minutes.


# Plugin to graph the savings made by micromiser

if [ "$1" = "autoconf" ]; then
        echo yes
        exit 0

if [ "$1" = "config" ]; then

        echo 'graph_title Micromiser Savings (percentage)'
        echo 'graph_args --upper-limit 100 -l 0'
        echo 'graph_vlabel savings'
        echo 'graph_category system'
        echo 'savings.label savings'
	echo 'savings.draw AREA'
        echo 'savings.min 0'
        exit 0

RES=`grep Estimated /var/log/syslog | tail -1 | sed 's/.*(\([0-9\.]*\)%)$/\1/'`
echo -n "savings.value $RES"