Ticket #253 (closed enhancement: patch does not fit)
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
Change History
Changed 2 years ago by human
-
attachment
lastupdate.diff
added
Changed 2 years ago by human
-
attachment
php_rrdtool.tar.gz
added
Newer PHP rrdtool module, with lastupdate support
Changed 2 years ago by human
-
attachment
lastupdate-php_rrdtool.diff
added
Patch file against original php-rrdtool module
comment:1 Changed 2 years 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
comment:2 Changed 2 years 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...



RRDtool update to allow programming call of rrd_lastupdate