0

i have create a rrd databasew (under php) with this code:

  $opts = array( "--step", "60",
 "DS:wattmin:GAUGE:300:0:8000",
 "RRA:AVERAGE:0.5:1:2160",
 "RRA:AVERAGE:0.5:5:2016",
 "RRA:AVERAGE:0.5:15:2880",
 "RRA:AVERAGE:0.5:60:8760",
 "RRA:MIN:0.5:1:2160",
 "RRA:MIN:0.5:5:2016",
 "RRA:MIN:0.5:15:2880",
 "RRA:MAX:0.5:60:8760",
 "RRA:MAX:0.5:1:2160",
 "RRA:MAX:0.5:5:2016",
 "RRA:MAX:0.5:15:2880",
 "RRA:MAX:0.5:60:8760");
$ret = rrd_create(RRD_DB_WP, $opts);

The image will be created like that:

$graphs=array("-6h","-12h","-1d","-1w","-1m","-1y");
$opts = array(
"-e now",
"--vertical-label=°C",
"-h 250",
"DEF:inoctets=".RRD_DB_WP.":wattmin:AVERAGE",
"AREA:inoctets#60B5E8:Watt/min",
"GPRINT:inbits:LAST:Las\: %4.0lfW",
"GPRINT:inbits:AVERAGE:Avg\: %4.0lfW",
"GPRINT:inbits:MAX:Max\: %4.0lfW\\n",
"DEF:grad8=".RRD_DB_TEMPS.":grad8:LAST",
"LINE2:grad8#F5A9A9:Wasser   ",
"GPRINT:grad8:LAST:Las\: %2.1lf°C",
"GPRINT:grad8:AVERAGE:Avg\: %2.1lf°C",
"GPRINT:grad8:MIN:Min\: %2.1lf°C",
"GPRINT:grad8:MAX:Max\: %1.1lf°C\\n"  );

$ret = rrd_graph(RRD_OUT_PATH. "/waermepumpe".$graph.".gif", $opts);

Everything works fine, but all data after 3 days are truncated and the created graphs after that time are always empty.

Bfo

user1912399
  • 7
  • 2
  • 9
  • It's a separate issue, but you should make your MAX calculation based on a DEF variable using a MAX CF (not AVERAGE) else you get max-of-average rather than max-of-max which gets progressively worse as your granularity decreases. Also your graph code doesnt match your RRD definition, where do grad8 and inbits come from? – Steve Shipway Jul 15 '22 at 00:23
  • The defs are ok, i have 2 RRDB's and has mixed from the first the create and from the second the create_graph code (sorry for that). Thanks for the hint with the calculation for use it with MAX and not AVERAGE. – user1912399 Jul 20 '22 at 13:46

1 Answers1

0

If your graphs are showing no data past 3 days, then they may be being generated using the smaller RRA for some reason, which does not hold data back that far.

Possible reasons for this

  • You have incorrectly created your RRD file and the larger RRAs are missing. Use rrdtool info to verify the RRD file structure is as you expect.
  • You have not collected data for that long ago. Use rrdtool dump to view the content of the RRA and confirm there really is data stored.
  • You have changed your RRA sizes or added new ones ( using rrdtool tune ) and though they now exist they do not have data
  • Your graphing is using incorrect start and endpoints for the time window
  • Your graphing is forcing 60s granularity - and hence the smaller RRA - but is trying to graph a time window outside of that RRA
Steve Shipway
  • 3,754
  • 3
  • 22
  • 39
  • Thanks for the answer. 1.) If i look into the db with "info", i see the structure, similar to that, how irt was created. 2.) The data will be updated periodicly (cron) every 1 minute. The created graphs show always only data of the last 3 Days. 3.) i had never changed the rrd db 4.) how can i fix the "60s granularity" problem? Bfo – user1912399 Jul 20 '22 at 13:50
  • Try making graphs using just one of the two RRD files. If this works then the issue is with their time windows being out of sync. Also use `rrdtool dump` to confirm that there actually is data in the RRAs going back past 3 days. – Steve Shipway Jul 21 '22 at 21:00