#!/bin/sh #------------------------------------------------------------------------------ # OPT_QOS /etc/rrdtool/qos.rrd __FLI4LVER__ # Creation: bastard # Last Update: $Id$ #------------------------------------------------------------------------------ [ -z "$RDTOOL_CONF_LOADED" ] && . /var/run/rrdtool.conf . /etc/rrdtool/rrdtool-helper local source=qos eval local idx='$RRDTOOL_'$source'_ID' eval local options='$RRDTOOL_'$idx'_OPTIONS_STRING' for item in $options do local interface= local db_file=$RRDTOOL_DB_PATH/$source/$item.rrd case "$item" in "down")interface='imq0';; "up") interface='imq1';; esac # # semaphore against spikes in qos-graphs # > /var/run/rrdtool.qos.$item if [ ! -f $db_file ] then echo 'creating new database for "'$source'" - "'$item'"' rrdtool create $db_file --step 60 \ `for i in \`tc -s class show dev $interface|grep 'class htb'|cut -d ' ' -f 3|cut -d ':' -f 2\` do echo "DS:$i:COUNTER:$heartbeat:0:4294967295" done` \ $rrdaverage $rrdmax else rrdheartbeat_change fi # # Avoid huge peaks at reboot # u=`for i in \`tc -s class show dev $interface|grep "class htb"|cut -d ' ' -f 3\` do echo -n U: done|sed '$s/.$//'` rrdtool update $db_file \ N:$u if [ $? -eq "0" ] then rm /var/run/rrdtool.qos.$item fi done