[rrd-developers] Preview for updated RRDTool PHP extension and userland wrapper

Benny Baumann BenBE at geshi.org
Mon Aug 24 16:36:45 CEST 2009


Hi,

I found some issues with yesterdays preview for the PHP extension and
wrapper library that could cause a memory leak under certain conditions.
They are fixed in this updated version

Also I added some more of RRDtools functions to the PHP extension
(rrd_tune, rrd_first, rrd_restore) as well as completed the transition
to skip the count of the options passed.

The interface to this updated PHP extension (should run with PHP4 and
PHP5) now looks like this:

Declared consts (Used for the header type with rrd_dump):
- RRD_DUMP_XML_NONE
- RRD_DUMP_XML_DTD
- RRD_DUMP_XML_XSD

/* {{{ proto mixed rrd_graph(string file, array args_arr)
    Creates a graph based on options passed via an array */
/* {{{ proto void rrd_clear_error(void)
    Clear the error set by the last rrd tool function call */
/* {{{ proto int rrd_update(string file, string opt)
    Update an RRD file with values specified */
/* {{{ proto int rrd_first(string file, [int index])
    Gets first update time of an RRA */
/* {{{ proto int rrd_last(string file)
    Gets last update time of an RRD file */
/* {{{ proto array rrd_info(string file)
    Gets structural information of an RRD file */
/* {{{ proto string rrd_dump(string file, [int header])
    Gets an XML dump of an RRD file */
/* {{{ proto array rrd_restore(string infile, string outfile)
    Restores an RRD file from a XML dump */
/* {{{ proto int rrd_create(string file, array args_arr)
    Create an RRD file with the options passed (passed via array) */
/* {{{ proto int rrd_tune(string file, array args_arr)
    Tune an RRD file with the options passed (passed via array) */
/* {{{ proto mixed rrdtool_info(bool as_array)
    Provide some information about the RRD extension and the used library */
/* {{{ proto string rrdtool_logo_guid()
    Query the RRD Tool Logo GUID used to display the RRD Tool Logo */

Also some functions (rrd_last and rrd_first, as well as rrd_info) now
use the _r-interface to access the rrd library, though in general this
extension isn't thread-safe due to GetOpt used inside most functions
(same problem as with the old API in general).

Compiling the PHP extension either using
# phpize && ./configure && make && make install
or as a PECL extension
# pecl install package.xml

The userland wrapper library has been updated now too: Support for
Creating, Analyzing, Updating and Fetching data from RRDs are basically
present, though the interface isn't fully implemented yet.

As with the preview yesterday, any feedback is appreciated. Suggestions
and bugreports welcome.

Regards,
BenBE.

P.S.: @Tobi: If you like you can add the extension as a contribution for
PHP5 or use it to update the outdated version in the SVN. The wrapper
shouldn't go there yet though as it isn't in a shape for this ATM.
Comments on its interface welcome though.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: php_rrdtool_ext.zip
Type: application/zip
Size: 18655 bytes
Desc: not available
Url : http://lists.oetiker.ch/pipermail/rrd-developers/attachments/20090824/0918e868/attachment-0001.zip 
-------------- 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/20090824/0918e868/attachment-0001.pgp 


More information about the rrd-developers mailing list