I generate a number of separate RRD databases, one per filesystem, 
containing usage data for users here. Then I generate some
graphs showing disk usage over time. I also use the data to calculate
some numbers like average usage per week, month, quarter etc.

# Week average for partition A
AWSUM="`rrdtool graph /tmp/dummy.png --start -1w --end -1d \
        DEF:kpartA=/var/rrd-data/LUSER/partA.rrd:space:AVERAGE \ 
        CDEF:partA=kpartA,1024,\* \
        PRINT:partA:AVERAGE:'%lf%s'| tail -1`"
        
# Week average for partition B
BWSUM="`rrdtool graph /tmp/dummy.png --start -1w --end -1d \
        DEF:kpartB=/var/rrd-data/LUSER/partB.rrd:space:AVERAGE \ 
        CDEF:partB=kpartB,1024,\* \
        PRINT:partB:AVERAGE:'%lf%s'| tail -1`"

# Global week average for partition A and B
GWSUM="`rrdtool graph /tmp/dummy.png --start -1w --end -1d \
        DEF:kpartA=/var/rrd-data/LUSER/partA.rrd:space:AVERAGE \ 
        CDEF:partA=kpartA,1024,\* \
        DEF:kpartB=/var/rrd-data/LUSER/partB.rrd:space:AVERAGE \ 
        CDEF:partB=kpartB,1024,\* \
        CDEF:sum=partA,partB,+ \
        PRINT:sum:AVERAGE:'%lf%s'| tail -1`"

This works great, except when all files for a user gets deleted from 
a partition - then the daily cron job doesn't update the RRD file for
that partition with any data - and so a NaN gets generated. That is
okey for the "BWSUM" value, but I'd still like the GWSUM value to be
computed correctly (ie be equal to AWSUM).

I tried "fixing" the problem by modifying the CDEF to be:

        CDEF:partX=kpartX,UN,0,kpartX,IF,1024,\*
        
But that causes GWSUM to be be equal to the old GWSUM value divided by 
two...

Any suggestions? (Except calculating GWSUM outside of rrdtool using the
per-partition outputs).

- Peter

-- 
Peter Eriksson <[EMAIL PROTECTED]>            Phone:    +46 13  28 2786
Computer Systems Manager/BOFH                Cell/GSM: +46 705 18 2786
Physics Department, Linköping University     Room:     Building F, F203
SE-581 83 Linköping, Sweden                  http://www.ifm.liu.se/~peter

--
Unsubscribe mailto:[EMAIL PROTECTED]
Help        mailto:[EMAIL PROTECTED]
Archive     http://www.ee.ethz.ch/~slist/rrd-users
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi

Reply via email to