jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [branches/] [HotSaNIC-0.5.0-pre6/] [tools/] [checkdbs.sh] - Rev 13 Go to most recent revision

Compare with Previous - Blame - Download


#!/usr/bin/env sh

if [ "$2" = "" ]; then num=30; else num=$2; fi

DIR=$1;
if [ "$DIR" = "" ]; then DIR="."; fi

if [ ! "$(echo $DIR|grep "^[0-9]*$")" = "" ]; then num=$DIR; DIR=".";fi

if [ ! -e $DIR ]; then
  echo "no such directory \"$DIR\""
  exit
  fi

if [ ! -e $DIR/rrd ]; then
  echo "no database directory found in \"$DIR\""
  exit
  fi

if [ $(ls $DIR/rrd | grep -c "\.rrd") -eq 0 ]; then
  echo "no databases found in \"$DIR/rrd/\""
  exit
  fi

# need BINPATH variable from main settings
#
BINPATH=""
if [ "$BINPATH" = "" ] && [ -e ../../../settings ] ; then . ../../../settings 
else
  if [ "$BINPATH" = "" ] && [ -e ../../settings ] ; then . ../../settings 
  else
    if [ "$BINPATH" = "" ] && [ -e ../settings ] ; then . ../settings 
    else if [ -e settings ] ; then . settings ; fi
    fi
  fi
fi

if [ "$BINPATH" = "" ]; then
echo "BINPATH variable not configured in main settings!"
echo "Check installation or call me from somewhere inside HotSaNIC!"
else
  for nn in $DIR/rrd/*; do
    echo "checking $nn"
    $BINPATH/rrdtool fetch $nn -s -$num AVERAGE
    echo;echo
    done
  fi

Powered by WebSVN 2.2.1