0

I am plotting a graph that includes variables from multiple rrd data files. I also display the last value of each variable on the graph. When I use, for example "CDEF:A=a,UN,0,a,IF,8,", then print last value of the variable A on the graph, depends on when I load the graph, the last value of A becomes 0 sometimes even though the last updated value in the rrd data file is not 0. I am using rrdtool 1.4.8. This doesn't not happen when I define A using "CDEF:A=a,8,".

Yue Lu
  • 85
  • 1
  • 8

1 Answers1

0

This is because you are using multiple RRD files, and there is a race condition between their update and your query. I have seen this happen in graphs generated by "Routers2" over MRTG data, and the program added special calculations to avoid it.

When you run your graph, the final point is based on the current time. However, the time bucket we are currently in may not have been updated in one of the source RRD files.

For example, say the data are updated every 5 minutes.

  • At 11:59, RRD file A is updated, and the 11:55 bucket is now complete.
  • At 12:01, RRD file B is updated, and the 12:00 bucket is now complete.
  • At 12:03, the graph function is called. The end of the graph is set to 12:00 as this is the latest available data.
  • However, for RRD file A, the latest available data is 11:55 as we have not had the 12:04 update yet. So, the last data point in the graph is unknown.

This is why you will occasionally get an unknown at the end of one of your data sets. It means that the RRD which sources that data is updating at the end of the time window you are currently in.

If you do not have the test for unknown, then the graph will simply not display the point in question (as unknown points are not plotted). So, if you look closely, you will see the line in the graph ends one pixel earlier.

One way to avoid this programmatically is to get the lastupdate time of all the component RRD files, and then use the earliest of these as the end time on the graph. This is the way the routers2 software avoids this problem.

Steve Shipway
  • 3,754
  • 3
  • 22
  • 39