1 | 1 | simandl | #!/usr/bin/env sh |
2 | | | |
3 | | | if [ "$2" = "" ]; then num=30; else num=$2; fi |
4 | | | |
5 | | | DIR=$1; |
6 | | | if [ "$DIR" = "" ]; then DIR="."; fi |
7 | | | |
8 | | | if [ ! "$(echo $DIR|grep "^[0-9]*$")" = "" ]; then num=$DIR; DIR=".";fi |
9 | | | |
10 | | | if [ ! -e $DIR ]; then |
11 | | | echo "no such directory \"$DIR\"" |
12 | | | exit |
13 | | | fi |
14 | | | |
15 | | | if [ ! -e $DIR/rrd ]; then |
16 | | | echo "no database directory found in \"$DIR\"" |
17 | | | exit |
18 | | | fi |
19 | | | |
20 | | | if [ $(ls $DIR/rrd | grep -c "\.rrd") -eq 0 ]; then |
21 | | | echo "no databases found in \"$DIR/rrd/\"" |
22 | | | exit |
23 | | | fi |
24 | | | |
25 | | | # need BINPATH variable from main settings |
26 | | | # |
27 | | | BINPATH="" |
28 | | | if [ "$BINPATH" = "" ] && [ -e ../../../settings ] ; then . ../../../settings |
29 | | | else |
30 | | | if [ "$BINPATH" = "" ] && [ -e ../../settings ] ; then . ../../settings |
31 | | | else |
32 | | | if [ "$BINPATH" = "" ] && [ -e ../settings ] ; then . ../settings |
33 | | | else if [ -e settings ] ; then . settings ; fi |
34 | | | fi |
35 | | | fi |
36 | | | fi |
37 | | | |
38 | | | if [ "$BINPATH" = "" ]; then |
39 | | | echo "BINPATH variable not configured in main settings!" |
40 | | | echo "Check installation or call me from somewhere inside HotSaNIC!" |
41 | | | else |
42 | | | for nn in $DIR/rrd/*; do |
43 | | | echo "checking $nn" |
44 | | | $BINPATH/rrdtool fetch $nn -s -$num AVERAGE |
45 | | | echo;echo |
46 | | | done |
47 | | | fi |