Home > RRDTool > Counter reset problem with RRDTool

Counter reset problem with RRDTool

December 17th, 2008 Leave a comment Go to comments

A common problem with rrdtool is to have a rrd file with one or more datasource configured as COUNTER, but your counter reset and you get an ugly high peak.

There is 2 solutions to solve this

  • In the “script” you use to generate the graph file you have something like DEF:A=/path/to/your/file.rrd:dsname:AVERAGE to get data, then you graph it with something like LINE1:A#…..
    Try to add CDEF:B=A,MINVALUE,GT,A,MAXVALUE,LT,A,UNKN,IF,UNKN,IF and graph B instead of A.
    Replace MINVALUE with the minimun value you want to graph (typically 0) and MAXVALUE with the maximum value you want on the graph (100000000 or something like this).
    This will suppress ugly peak on the graph.
  • The second (better) solution is to change from COUNTER DS to DERIVE DS, to do so follow theses commands:
    # cp file.rrd file.rrd.bkup # this is to backup the file !
    # rrdtool tune file.rrd
    # rrdtool tune file.rrd --data-source-type dsname:DERIVE # this change DS dsname from COUNTER to DERIVE
    # rrdtool tune file.rrd --minimum dsname:0 --maximum dsname:100000000 # Set the min and max value of data you have to graph
    # rrdtool tune file.rrd
    # rrdtool dump file.rrd > file.xml # Dump data to xml file
    # rrdtool restore -r file.xml file.rrd.new # This restore xml data in rrd file with a check on value
    # to suppress value higher than --maximum you choose
Categories: RRDTool Tags: ,
  1. No comments yet.
  1. No trackbacks yet.