[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [hobbit] rrdtool from private scripts
- To: hobbit (at) hswn.dk
- Subject: Re: [hobbit] rrdtool from private scripts
- From: "Ralph Mitchell" <ralphmitchell (at) gmail.com>
- Date: Wed, 18 Oct 2006 11:53:01 -0500
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=I6bkWA8Z1UpPDa9/QCoGbKd6AjA5gSwKW+bu4Yz1/IkV2A/gA4f3PEAqVCV73WU/IC3fD/+31uFXJiUbyM6nXINLSqMajOj4SIWMi6fbUiu4tBq/u1MBPoiYdBJXRhq4oabGTu5rg8mehRQx1n120VnnTAIvc0IZKbB3IT3rEpE=
- References: <64402.10.0.0.1.1161193350.squirrel@www.tumfatig.net> <997a524e0610180946y4dbff0b2ledcfd19a0e920479@mail.gmail.com>
On 10/18/06, Ralph Mitchell <ralphmitchell (at) gmail.com> wrote:
On 10/18/06, joel (at) carnat.net <joel (at) carnat.net> wrote:
> Hi,
>
> I wrote a script to get alert about CPU loads on a windows server using
> SNMP (no I don't want to / can't install the hobbit client on the server
> ;). The status is returned OK (green before 50%, orange from 50 to 75 and
> red over 75).
>
> The thing is, there is no graph done (yet).
> I would like a graph that would show the load average variation.
>
> (how) can the script be used to fill a RRD database ?
> Should the load average value be returned in a special variable ?
>
I'm doing something similar - SNMP queries against a Compaq system to produce a report like this:
CPU 1 min 5 min 30 min 60min
&green 0 14% 9% 9% 9%
&green 1 11% 7% 9% 9%
I changed the [rrdstatus] entry in server/etc/hobbitlaunch.cfg to include the --extra-script & --extra-tests entries as described in the hobbit_rrd man page.
If it gets through the mail system, my collection script is attached. It's not rocket science, but it seems to get the job done.
That pokes the data into an RRD, then it's just a question of setting up the graph config to show what you want to see.
Ralph Mitchell
The script was blocked, so here it is:
Ralph Mitchell
#!/bin/sh
# Input parameters: Hostname, testname (column), and messagefile
#
# Messagefile contains this:
# Thu Jan 12 06:33:28 CST 2006 compaq_cpu
#
# This checkout shows CPU utilization as a percentage of the
# theoretical maximum over 1min, 5min, 30min & 60min periods.
#
#
#
# CPU 1 min 5 min 30 min 60min
# &green 0 7% 7% 6% 7%
# &green 1 7% 9% 8% 10%
#
#
TMPLOG="/tmp/$1.$2.out"
echo "$1, $2, $3" > $TMPLOG
cat $3 >> $TMPLOG
HOSTNAME="$1"
TESTNAME="$2"
FNAME="$3"
# Check the test name so that this script can service multiple
# data collection needs
if [ "$TESTNAME" = "cpqcpu" ]
then
# The RRD dataset definitions
echo "DS:1min:GAUGE:600:0:100"
echo "DS:5min:GAUGE:600:0:100"
echo "DS:30min:GAUGE:600:0:100"
echo "DS:60min:GAUGE:600:0:100"
# Analyze the message we got
cat $FNAME | while read line
do
if [ "$line" ]; then
line=`echo $line | sed -e 's/&//g' -e 's/%//g'`
set $line
case $1 in
green)
echo "cpqcpu.$2.rrd"
echo "$3:$4:$5:$6"
echo "cpqcpu.$2.rrd" >> $TMPLOG
echo "$3:$4:$5:$6" >> $TMPLOG
;;
yellow)
echo "cpqcpu.$2.rrd"
echo "$3:$4:$5:$6"
echo "cpqcpu.$2.rrd" >> $TMPLOG
echo "$3:$4:$5:$6" >> $TMPLOG
;;
red)
echo "cpqcpu.$2.rrd"
echo "$3:$4:$5:$6"
echo "cpqcpu.$2.rrd" >> $TMPLOG
echo "$3:$4:$5:$6" >> $TMPLOG
;;
*)
;;
esac
fi
done
fi
exit 0