[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Custom graphs (was: temperature-larrd.pl)
- To: hobbit (at) hswn.dk
- Subject: Custom graphs (was: temperature-larrd.pl)
- From: Henrik Stoerner <henrik (at) hswn.dk>
- Date: Fri, 4 Feb 2005 23:51:04 +0100
- References: <20050125101627.GA4000@hswn.dk> <41F816DD.5030301@cisco.com> <20050126222913.GB11218@hswn.dk> <41F9C377.4070302@cisco.com> <41F9CB61.7050109@cisco.com> <20050128092542.GA29457@hswn.dk> <41FA0D88.4000900@cisco.com> <41FA0E97.5070401@cisco.com> <20050128112203.GA31554@hswn.dk> <41FA264F.1040806@cisco.com>
- User-agent: Mutt/1.5.5.1i
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