[hobbit] Custom graphs (was: temperature-larrd.pl)
Kevin Hanrahan
Kevin at ewormhole.com
Sat Feb 5 04:27:44 CET 2005
I could use this for a great number of data sets!
-----Original Message-----
From: Henrik Stoerner [mailto:henrik at hswn.dk]
Sent: Friday, February 04, 2005 5:51 PM
To: hobbit at hswn.dk
Subject: [hobbit] Custom graphs (was: temperature-larrd.pl)
Importance: Low
On Fri, Jan 28, 2005 at 04:47:27AM -0700, Charles Jones wrote:
> Speaking of this, it sure would be nice to have some sort of plugin
> system, or something for easily creating custom graphs. I can think of
> many uses for simple one-element graphs (temperature, emails sent per
> day, etc).
Sounds reasonable. I've found a way of doing this that keeps as much as
possible of the RRD handling in Hobbit, and makes it easy to use custom
scripts (written in your favourite scripting language) to process a message
and pick out the interesting data you want to put into a graph.
Basically, you tell hobbitd_larrd which status- or data-messages are handled
by an external script, and what the script is. Your script is then called
when such a message arrives, and is fed the status message in a file. In
return, the script must output the RRD definitions for the data you want to
store, a filename for the RRD file, and the values.
E.g. if you have a message like
green Weather in Copenhagen is FAIR
Temperature: 6
Wind: 4
Humidity: 72
and you want to track these, then this script would do:
#!/bin/sh
# Input parameters: Hostname, testname (column), and messagefile
HOSTNAME="$1"
TESTNAME="$2"
FNAME="$3"
# Analyze the message we got
TEMP=`cat $FNAME | grep "^Temperature:" | awk '{print $2}'
WIND=`cat $FNAME | grep "^Wind:" | awk '{print $2}'
HMTY=`cat $FNAME | grep "^Humidity:" | awk '{print $2}'
# The RRD dataset definition
echo "DS:temperature:GAUGE:600:-30:50"
echo "DS:wind:GAUGE:600:0:U"
echo "DS:humidity:GAUGE:600:0:100"
# The filename
echo "weather.rrd"
# The data
echo "$TEMP:$WIND:$HMTY"
exit 0
Does that seem like a usable plug-in facility ?
Henrik
To unsubscribe from the hobbit list, send an e-mail to
hobbit-unsubscribe at hswn.dk
More information about the Xymon
mailing list