[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [hobbit] Sending data from script to an rrd



On 10/18/06, Rob Munsch <rmunsch (at) solutionsforprogress.com> wrote:

I still do not quite get how the actual data gets to rrd. It seems to me that there is an isolated client script that sends data which determines the status color.. then a DIFFERENT server-side script is used to send the SAME DATA to RRD for graphing. ?!?! yesno?

Yep.

Why isn't there a way to use the existing data that the client's sending
for graphing... for CPU, MEM, etc. isn't that already happening?  or
have i failed another concept here.

I think it is using the existing data... If the incoming report looks like it should be graphed (via TRENDS in bb-hosts, I think) it gets shunted to the hobbit_rrd program which does nothing if it finds none of the standard data (uptime, df, vmstat, etc). That's where the --extra-script script comes in. It breaks up the message into a form that hobbit_rrd can read. hobbit_rrd does something like fork-and-execute to run the extra script, and listens to the output channel from the script. It expects to see the RRD creation formula, the RRD name, then an RRD data string. hobbit_rrd then does whatever magic is required to stuff the data into the RRD file.

On the server, i have made all config changes (despite the badly-crafted
graph definition) but there is NO rrd data collected.  I still don't get
the client-server communication, i guess.

Does anyone have a sample of a server-side RRD data collection script i
could borrow, so i see how and where from it's grabbed?  Thanks...


This is a hobbit_rrd script I use to pick up numbers from a cpu load report gathered from Compaq servers via an SNMP query. The line

  if [ "$TESTNAME" = "cpqcpu" ]

allows the same script to process reports from multiple different
column names.  In this particular case, the column is 'cpqcpu'.

Rlaph 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