Ticket #253 (closed enhancement: patch does not fit)

Opened 6 months ago

Last modified 5 months ago

Add rrd_lastupdate to all bindings (including PHP)

Reported by: human Owned by: oetiker
Priority: major Milestone:
Component: misc Version:
Keywords: Cc: jyavenard@…

Description

From Jean-Yves Avenard: jyavenard@…

For some reasons, the rrd_lastupdate isn't available through the RRD programming bindings (except for the Tcl and Perl-piped which are simply calling the main rrdtool command line).

For some reasons, rrd_lastupdate API is set up very differently than all other APIs and isn't suitable for export (it simply does a printf of the values).

This patch adds a new rrd_lastupdate_s entry point, that behaves like the other entry points. A new name had to be used in order to keep backward compatibility. rrd_lastupdate returns the timestamp of the last entry, the list of DS names in the RRD file and the list of the last values entered. Note that the list of last values is made of strings and not long/integer as this is what's returned by the internal call rrd_lastupdate_r

Also attached are the updated bindings for: -Python -Ruby -Perl-shared -Lua

Perl and Lua updates weren't tested, but I'm fairly confident it's fine. (after updating all the other bindings, I got the hang of it :) )

Also attached is the update RRDTool-PHP module (both complete archive and a diff with original files)

Attachments

lastupdate.diff Download (11.0 KB) - added by human 6 months ago.
RRDtool update to allow programming call of rrd_lastupdate
php_rrdtool.tar.gz Download (9.7 KB) - added by human 6 months ago.
Newer PHP rrdtool module, with lastupdate support
lastupdate-php_rrdtool.diff Download (3.3 KB) - added by human 6 months ago.
Patch file against original php-rrdtool module

Change History

Changed 6 months ago by human

RRDtool update to allow programming call of rrd_lastupdate

Changed 6 months ago by human

Newer PHP rrdtool module, with lastupdate support

Changed 6 months ago by human

Patch file against original php-rrdtool module

Changed 5 months ago by oetiker

  • status changed from new to closed
  • resolution set to patch does not fit

Hi Jean,

the reason rrdlast has no bindings, is that it was invented for the benefit of shellscripters .. is there any particular functionality that is not realizable using rrdfetch ?

if rrdlast was to be changed for inclusion into the language bindings it would have to start using the rrd_info interface.

cheers tobi

Changed 5 months ago by human

rrdfetch will only let you retrieve the data as stored in the database, that is a rate.

rrdlast retrieve the last values as entered, not rates.

That's the major difference. There is no need of knowing weither the data is a GAUGE, COUNTER or DERIVE and multiplying or not by the resolution...

No matter the DS format stored in the database, rrdlast return the last value entered, always It's not something you can easily do with rrdfetch.

Where can I find info regarding the rrd_info interface? I've carefully matched the new code to be similar to the old bindings ; none of which seems to use info...

Changed 5 months ago by oetiker

ok, then replace rrdlast with rrdinfo because rrdinfo also gives you the last value entered ...

as for the rrd_info interface ... look at rrd_update_v, rrd_graph_v and rrd_info

cheers tobi

Note: See TracTickets for help on using tickets.

NOTE: The content of this website is accessible with any browser. The graphical design though relies completely on CSS2 styles. If you see this text, this means that your browser does not support CSS2. Consider upgrading to a standard conformant browser like Mozilla Firefox or Opera but also Apple's Safari or KDE's Konqueror for example. It may also be that you are looking at a mirror page which did not copy the CSS for this page. Or if some pictu res are missing, then the mirror may not have picked up the contents of the inc directory.