0

When I generate a graph for weekly, the value is 4 but when I generate for monthly, the value is about 2.1

I try to fetch the data and the value is 4. data is the same when fetching with the timestamp for a week/month

Weekly_Graph

Monthly_Graph

My rrd info:

filename = "icscf_1_tpip_total.rrd"
rrd_version = "0003"
step = 900
last_update = 1610441186
header_size = 6176
ds[max_in].index = 2
ds[max_in].type = "GAUGE"
ds[max_in].minimal_heartbeat = 1000
ds[max_in].min = NaN
ds[max_in].max = NaN
ds[max_in].last_ds = "2.0"
ds[max_in].value = 1.7200000000e+02
ds[max_in].unknown_sec = 0
rra[0].cf = "AVERAGE"
rra[0].rows = 96
rra[0].cur_row = 85
rra[0].pdp_per_row = 1
rra[0].xff = 0.0000000000e+00
rra[0].cdp_prep[2].value = NaN
rra[0].cdp_prep[2].unknown_datapoints = 0
rra[1].cf = "AVERAGE"
rra[1].rows = 96
rra[1].cur_row = 34
rra[1].pdp_per_row = 1
rra[1].xff = 0.0000000000e+00
rra[1].cdp_prep[2].value = NaN
rra[1].cdp_prep[2].unknown_datapoints = 0
rra[2].cf = "AVERAGE"
rra[2].rows = 2880
rra[2].cur_row = 1828
rra[2].pdp_per_row = 1
rra[2].xff = 0.0000000000e+00
rra[2].cdp_prep[2].value = NaN
rra[2].cdp_prep[2].unknown_datapoints = 0
rra[3].cf = "MAX"
rra[3].rows = 52
rra[3].cur_row = 43
rra[3].pdp_per_row = 672
rra[3].xff = 0.0000000000e+00
rra[3].cdp_prep[2].value = 4.0000000000e+00
rra[3].cdp_prep[2].unknown_datapoints = 489

My RRD command: Weekly:

rrdtool graph /.../Maximum_incoming_call.png 
--start 1610104905 
--end 1610709705 
--title Maximum_incoming_call 
--lower-limit 0 
--alt-autoscale-max 
--slope-mode 
--units=si 
--alt-y-grid TEXTALIGN:left COMMENT:"1 G = 1.000.000.000 | 1 M = 1.000.000 | 1 k = 1.000 \n"  
DEF:test0="/..../icscf_1_tpip_total.rrd":max_in:AVERAGE 
LINE:test0#FF0000:"tpip total" 
--width 600 
--height 352

Monthly:

rrdtool graph
/.../Maximum_incoming_call.png
--start 1608117756 
--end 1610709756 
--title Maximum_incoming_call 
--lower-limit 0 
--alt-autoscale-max 
--slope-mode 
--units=si 
--alt-y-grid TEXTALIGN:left COMMENT:"1 G = 1.000.000.000 | 1 M = 1.000.000 | 1 k = 1.000 \n"
DEF:test0="/..../icscf_1_tpip_total.rrd":max_in:AVERAGE 
LINE:test0#FF0000:"tpip total" 
--width 600 
--height 352

I don't know why It's working good for weekly but monthly is display only a half like in the imagine.

My rrdtool fetch:

rrdtool fetch icscf_1_tpip_total.rrd AVERAGE --start 1610104905 --end 1610709705
                max_in 
.....
1610418600:  4.0000000000e+00
.....


rrdtool fetch icscf_1_tpip_total.rrd AVERAGE --start 1608117756 --end 1610709756
                    max_in  
....   
1610418600: 4.0000000000e+00  
....

1 Answers1

0

This is because of implicit averaging in your graph.

First, lets leave aside the question of why your RRA 0, 1 and 2 are all of type AVERAGE with 1cdp=1pdp. Your RRA 0 and 1 are totally superfluous. You may want to review how you create your RRD file.

When you do a rrdtool graph then you're going to be using the 1cdp=1pdp RRA, which is in effect the raw data. However, once the data width gets larger than 1cdp per pixel, RRDTool will implicitly consolodate the data before displaying.

If you're showing a weekly graph, then you'll end up with 1 pixel per cdp (well actually 672 cdp for 600 pixels, but its close enough), and so you'll be displaying the stored value in the RRA (in this case, 4.0). However, when you do it for a month, you'll have 4 times as many samples but the same number of pixels. Thus, your displayed pixels will in fact be the average of 4 data points (well, 4.48cdp to be precise). This means that, if the data are irregular, it will smooth out the data and you'll get lower peaks, which is what you're seeing (a value of 2.1 in your example).

When you do a rrdtool fetch then you're pulling the data straight from the RRA without consolodation (unless you explicitly request it). So, in this case, you see the 4.0 again.

What to do about this depends on what you want to see. Since you have a MAX RRA at the higher resolution, you have a few options -

  • Graph two lines for your monthly graph - an AVERAGE, and a MAX. You may also want to add a MIN RRA and show that line, depending on how spiky tha data are.
  • Use your AVERAGE RRA, but explicitly tell RRDTool (in the DS definition) to use MAX as the secondary consolodation method. This is not so good as it gives a misleadingly high value but it is more what you're expecting to see
  • Keep it this way, and add some text to explain the data have been averages over the graph pixel time interval
  • Make the graph 4x wider so that the number of pixels again matches the number of cdp and additional consolodation is not required
Steve Shipway
  • 3,754
  • 3
  • 22
  • 39
  • Thank you so much. I try to expand more the width to about 2400 pixels and it shows a value of 4 for me. I got it. – Lâm Huynh Van Jan 18 '21 at 08:31
  • Hi Steve, I am trying to use the VDEF to draw a MAX line but it seems the same behavior that the line still through the 2.x value. Then I am trying to use rrdtool tune to alter the max value of my RRD file and still no hope. Can you tell me how to Use AVERAGE RRA, but explicitly tell RRDTool (in the DS definition) to use MAX as the secondary consolodation method. I am trying to make graph 4x wider then resize but it seems no good for my UI. Please help me. – Lâm Huynh Van Jan 19 '21 at 03:07
  • If you use a MAX CF over the AVERAGE RRA then you might get odd behaviour. Better is to have a MAX RRA and then work on that for your VDEF. You can always define an additional MAX-type DS to use. Otherwise, you can use the option `:reduce=MAX` in your DS definition but watch out for side effects https://oss.oetiker.ch/rrdtool/doc/rrdgraph_data.en.html – Steve Shipway Jan 20 '21 at 22:23