Date created: Monday, August 19, 2013 2:40:16 PM. Last modified: Tuesday, September 19, 2017 12:03:15 PM

RRDTool Missing Values

Replacing missing values with either a 0, which reduce the average value, or with the last recorded valid value (PREV);

./rrdmissing.sh 1372633200 1377989700 /var/lib/cacti/rra/customer-cpe_traffic_in_114.rrd

5: Average values, replace unavailable values with PREVious
2.65 Mb
2.99 Mb

5: Average values, replace unavailable values with 0
2.17 Mb
2.37 Mb

5: MAX values, replace unavailable values with PREVious
12.69 Mb
13.80 Mb

5: MAX values, replace unavailable values with 0
12.69 Mb
13.80 Mb


#!/bin/bash

echo -e -n "\n5: Average values, replace unavailable values with PREVious"
rrdtool graph -f '' -s $1 -e $2 /dev/null \
DEF:in="$3":traffic_in:AVERAGE \
DEF:out="$3":traffic_out:AVERAGE \
CDEF:inbits=in,8,* \
CDEF:outbits=out,8,* \
CDEF:safein=inbits,UN,PREV,inbits,IF \
CDEF:safeout=outbits,UN,PREV,outbits,IF \
VDEF:finalin=safein,95,PERCENT \
VDEF:finalout=safeout,95,PERCENT \
PRINT:finalin:"%.2lf %Sb" \
PRINT:finalout:"%.2lf %Sb"

echo -e -n "\n5: Average values, replace unavailable values with 0"
rrdtool graph -f '' -s $1 -e $2 /dev/null \
DEF:in="$3":traffic_in:AVERAGE \
DEF:out="$3":traffic_out:AVERAGE \
CDEF:inbits=in,8,* \
CDEF:outbits=out,8,* \
CDEF:safein=inbits,UN,0,inbits,IF \
CDEF:safeout=outbits,UN,0,outbits,IF \
VDEF:finalin=safein,95,PERCENT \
VDEF:finalout=safeout,95,PERCENT \
PRINT:finalin:"%.2lf %Sb" \
PRINT:finalout:"%.2lf %Sb"

echo -e -n "\n5: MAX values, replace unavailable values with PREVious"
rrdtool graph -f '' -s $1 -e $2 /dev/null \
DEF:in="$3":traffic_in:MAX \
DEF:out="$3":traffic_out:MAX \
CDEF:inbits=in,8,* \
CDEF:outbits=out,8,* \
CDEF:safein=inbits,UN,PREV,inbits,IF \
CDEF:safeout=outbits,UN,PREV,outbits,IF \
VDEF:finalin=safein,95,PERCENT \
VDEF:finalout=safeout,95,PERCENT \
PRINT:finalin:"%.2lf %Sb" \
PRINT:finalout:"%.2lf %Sb"

echo -e -n "\n5: MAX values, replace unavailable values with 0"
rrdtool graph -f '' -s $1 -e $2 /dev/null \
DEF:in="$3":traffic_in:MAX \
DEF:out="$3":traffic_out:MAX \
CDEF:inbits=in,8,* \
CDEF:outbits=out,8,* \
CDEF:safein=inbits,UN,0,inbits,IF \
CDEF:safeout=outbits,UN,0,outbits,IF \
VDEF:finalin=safein,95,PERCENT \
VDEF:finalout=safeout,95,PERCENT \
PRINT:finalin:"%.2lf %Sb" \
PRINT:finalout:"%.2lf %Sb"