[rrd-developers] Suggestion for API extension

Benny Baumann BenBE at geshi.org
Thu Jul 30 07:24:33 CEST 2009


I recently discovered the PHP extension for RRDTool which is available
as a contribution to RRDTool. This extension runs successfully with
latest PHP5, but misses some functions of current RRDTool releases (no
rrd_dump, no rrd_info). I'm currently working on updating the PHP
extension to also include these operations.

And here comes the issue: The RRDTool library is more or less written to
be used in the command line interface thus either returns only single
values or dumps output to a file\terminal. For the PHP extension I need
output to be written into a buffer though.

To solve this I suggest adding a callback interface to e.g. rrd_dump
that is called whenever string data (or binary data) has to be returned.
An example implementation for rrd_dump_opt_cb_r can be found in the
attached patch. Feedback appreciated. IDK if this patch is complete and
if the mentioned rrd_dump_opt_cb_r function is properly exported; but at
least dumping should work.

The basic rrd_dump_opt_r now calls this Callback method internally to
give an example of how this callback interface can be used and to avoid
duplicate source.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: rrd_dump_cb.patch
Type: text/x-diff
Size: 30891 bytes
Desc: not available
Url : http://lists.oetiker.ch/pipermail/rrd-developers/attachments/20090730/9929d902/attachment-0002.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
Url : http://lists.oetiker.ch/pipermail/rrd-developers/attachments/20090730/9929d902/attachment-0003.bin 

More information about the rrd-developers mailing list