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
.
Is there an easy/elegant way to accomplish this?
3
Answers
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
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:
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
and then start adding 0 or 1 to this DS if your primary DS is not available
at the end for drawing the graph:
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.
This method plots an area when "offline". The
CDEF
checks if theload
measurement isUN
(unknown), if it is, it will return1
, multiply byINF
to make it to the highest value of the plot.