[mrtg] MRTG, RRDtool and one minute samples

Dustin Lundquist dlundquist at opticfusion.net
Wed Apr 7 22:43:01 MEST 2004


I have MRTG v2.10.13, RRDtool v1.0.45 and routers2.cgi v2.14beta5 installed.
I have modified MRTG's RRD databases to keep 6 hours worth of 1 minutes
samples, 40 days worth of 5 minutes averages (to calculate the 95th from)
and a years worth of daily averages by patching MRTG based on Nicalas
Sayer's 1minMRTG patch. Both 14all.cgi and routers2.cgi generate graphs from
the MRTG RRD databases that match the data of our production MRTG box
(v2.10.11 w/o RRDtool).

Due to poor preformace of the CGI scripts, I've written a bash script to be
called by a cron job run every 5 minutes and generate static graphs of the
last 5 hours using the one minute samples. Some of the graphs are off by a
factor of 10. Can any one help and spot what I'm doing wrong?

---begin drawgraphs.sh----
#!/bin/sh

graphs_dir=/home/mrtg/graphs
config_dir=/home/mrtg/etc
rrd_db_dir=/home/mrtg/db

egrep ^Title $config_dir/mrtg-*.cfg | \
cut -d\: -f2- | \
sed s/'^Title\['// | \
sed s/'\]: '/\,/ | \
while read line; do \
        target=`echo $line | cut -d\, -f1`
        directory=`echo $target | cut -d_ -f1`
        title=`echo $line | cut -d\, -f2`

        rrd_db=`echo -n $rrd_db_dir/$directory/; echo $target | tr
"[:upper:]" "[:lower:]"`.rrd
        graph=`echo $graphs_dir/$directory/$target`.png

        if [ ! -d $graphs_dir/$directory ]; then
                mkdir -p $graphs_dir/$directory
        fi

#       echo $rrd_db
#       echo $graph

        /usr/local/bin/rrdtool graph $graph --title="$title" \
                --start \-18000 \
                --end now \
                -S 60 \
                -a PNG \
                DEF:ds0=$rrd_db:ds0:AVERAGE \
                DEF:ds1=$rrd_db:ds1:AVERAGE \
                AREA:ds0#00eb0c\
                LINE1:ds1#1000ff
done
---end drawgraphs.sh---

Thanks,


Dustin Lundquist
Optic Fusion

--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the mrtg mailing list