On Thursday 23 Feb 2006 04:08, Arjun wrote:
> I still need to write directly to MySql so do you have any ideas there ?

Well, from a casual scan through the source (and at the risk of pointing out 
the moderately obvious :-)

process_xml.c:630 has (for the full data)
                  xmldata->rval = write_data_to_rrd(xmldata->sourcename,
                        xmldata->hostname, name, metricval, NULL,
                        xmldata->ds->step, xmldata->source.localtime);

and 933 has (for the summary data)
           xmldata->rval = write_data_to_rrd(xmldata->sourcename, NULL, name,
                   sum, num, xmldata->ds->step, xmldata->source.localtime);

The hacky way of fixing it would be to use a macro expansion to replace 
write_data_to_rrd() with either the existing RRD function, or a MySQL one.  A 
better way would be to have an abstract function that can switch at run-time 
(provided MySQL support has been compiled in).

The MySQL function would then construct the appropriate SQL, and fire it off 
using the mysql C-library bindings.  Once you've built a suitable database 
schema and off you go!

You might have to support adding extra columns on-the-fly.  For example, if 
gmetrics are added (at a later date), then the database schema should be 
adapted to store the extra data.

Good luck!

HTH,

Paul.


Attachment: pgpoWTAiYGuMC.pgp
Description: PGP signature

Reply via email to