#! /bin/bash # script to create a MRTG style rrd table # tnka@linux-sottises.net # check general config file exists if ! [ -f /etc/mrtnk.setup ];then echo "Error: you have to put mrtnk.setup in /etc" exit 1 fi # General Parameters . /etc/mrtnk.setup # arguments: 1:create 2:filename 3:(GAUGE|COUNTER) 4:frequence(in seconds) # 5:minimum 6:maximum # OR # 1:update 2:filename 3: script name case "$1" in create) BEAT=$(($4*2)) if [ "$BEAT -gt 600" ]; then BEAT=600 fi $RRD create $LOGS/$2 -s $4 \ DS:ds0:$3:$BEAT:$5:$6 \ DS:ds1:$3:$BEAT:$5:$6 \ RRA:AVERAGE:0.5:1:600 \ RRA:AVERAGE:0.5:6:700 \ RRA:AVERAGE:0.5:24:775 \ RRA:AVERAGE:0.5:288:797 \ RRA:MAX:0.5:1:600 \ RRA:MAX:0.5:6:700 \ RRA:MAX:0.5:24:775 \ RRA:MAX:0.5:288:797 ;; update) RESULT=`$SCRIPTS/$3` IN=`echo $RESULT | cut -d" " -f1` OUT=`echo $RESULT | cut -d" " -f2` $RRD update $LOGS/$2 N:$IN:$OUT ;; *) echo "Usage:" echo "rrd-tnk create filename (GAUGE|COUNTER) frequence min max" echo "OR" echo "rrd-tnk update filename scriptname" exit 1 esac exit 0