Discussion:
[rrd-users] RRDTool lib fetch
(too old to reply)
Olivier
2015-11-03 16:29:10 UTC
Permalink
Hello,

I'm looking for documentation on rrdtool library. I'm actually using it
through PHP and PECL project. I'm using function rrd_fetch() to grab data
from a specific .rrd file.

I can see that 'resolution' parameter is not respected (as rrd_graph is
doing) : RRD seems to find the most accurate resolution available, but
returns the raw data. For example, if I have data with resolution =60 and I
request resolution =3600, data is not aggregated, and I have one row every
minute instead of one per hour.

First, I want to know if this is an expected behaviour. In that case, it
means that rrd_graph is doing this aggregate itself. Is there a way to ask
rrdtool to do the math for me ?


Olivier
Steve Shipway
2015-11-03 21:01:21 UTC
Permalink
This is expected behaviour.



‘Rrdtool fetch’ will return the raw data, using the RRA that most closely approximates the requested data resolution. So, if you request a resolution of 3600, and only have a 300 RRA available, then this will be used. However, if you have a 3600 RRA then this will be chosen. In addition, RRDTool will ensure the time window is fully covered before selecting a resolution; so you need to be careful of fencepost errors where only the last sample is unavailable at your selected resolution and so it fails back to a lower granularity RRA. The graph function, on the other hand, will perform on-the-fly aggregation and calculation to generate a data set in the required resolution before graphing.



If you want to have the data pre-aggregated, then either ensure that a suitable RRA exists in the RRD, or else use ‘rrdtool xport’, which is like the graph function but returns the data instead (after calculation and aggregation if necessary)



Steve



Steve Shipway

T: +64 9 3737 599 ext 86487

E: ***@auckland.ac.nz <mailto:***@auckland.ac.nz>

(GNU Terry Pratchett)



From: rrd-users [mailto:rrd-users-bounces+s.shipway=***@lists.oetiker.ch] On Behalf Of Olivier
Sent: Wednesday, 4 November 2015 5:29 a.m.
To: rrd-***@lists.oetiker.ch
Subject: [rrd-users] RRDTool lib fetch



Hello,



I'm looking for documentation on rrdtool library. I'm actually using it through PHP and PECL project. I'm using function rrd_fetch() to grab data from a specific .rrd file.

I can see that 'resolution' parameter is not respected (as rrd_graph is doing) : RRD seems to find the most accurate resolution available, but returns the raw data. For example, if I have data with resolution =60 and I request resolution =3600, data is not aggregated, and I have one row every minute instead of one per hour.

First, I want to know if this is an expected behaviour. In that case, it means that rrd_graph is doing this aggregate itself. Is there a way to ask rrdtool to do the math for me ?



Olivier

Loading...