skip to Main Content

I’m plotting a number of data on various graphs using RRDTool, occasionally I get unknown data points, this is totally expected especially if the computer updating the RRDs is offline.

That’s cool, however, when this happens, I want there to be a nice big red line (for each and every unkonwn so it makes the graph’s viewer very aware that the value at those points is not 0, but actually UNKNOWN.

What I have:
RRDTool Graph showing Load Average

What I want (Photoshopped):
enter image description here

Is there an easy/elegant way to accomplish this?

3

Answers


  1. Chosen as BEST ANSWER

    Here's what worked:

    I used the CDEF with an existing Data Source (DS) instead of having to create a new DS.

    I added the following 2 lines in my RRDTool Graph section

    'CDEF:up=a1,0,*,0,EQ,0,1,IF' 
    'TICK:up#DB0865:1.0'         
    

    The CDEF doe the calculation of:

    a1 * 0

    Then compares the the result of that to 0. If they're equal, set "up" to "0" else set "up" to "1".

    The only time that they would not be equal, would be if "a1" was unknown.

    Therefore when there is a gap in the graph (no data), it will have a 100% vertical bar (TICK) of a deep purple/pink colour (#DB0865)

    Even though the documentation on the RRDTool site Indicates that a DS can be added to an existing RRD, it actually cannot be (according to Tobi Oetiker). So I went with the above method to avoid losing all the data in the rrds that I already have when creating a new rrd with a new DS.

    Here's an example of how it looks: RRD Graph showing unknown data highlighted


  2. The elegant way would be to check if load includes any reasonable value. If not add 1 to DS that you create for this purpose.

    So for Robin Database add new DS that will have value 0 or 1

    DS:somestatus1:GAUGE:600:U:U
    

    and then start adding 0 or 1 to this DS if your primary DS is not available

    at the end for drawing the graph:

    DEF:somestatus1=$RRD_FILE:somestatus1:AVERAGE 
    CDEF:my_status_cdef=somestatus1,1,0,IF 
    TICK:my_status_cdef#e0ffe0:1.0:"Device was ONn" 
    

    each TICK will draw 100% height vertical bar over the graph as you need

    Another option is to create conditional CDEF that will create TICK if primary DS is none.

    Login or Signup to reply.
  3. This method plots an area when "offline". The CDEF checks if the load measurement is UN (unknown), if it is, it will return 1, multiply by INF to make it to the highest value of the plot.

    CDEF:offline=load,UN,INF,* 
    AREA:offline#FF000011: 
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search