[collectd] curl_xml plugin

Florian Forster octo at verplant.org
Mon Dec 21 19:29:11 CET 2009


Hi Amit,

On Mon, Dec 21, 2009 at 02:11:01PM +0530, Amit Gupta wrote:
> Any comments on the plugin will be appreciated.

oh, sorry, I lost track of that :/ I've added the plugin to the roadmap
[0] so this doesn't happen again.

> > > I have been working on curl_xml plugin. The idea of this plugin is
> > > to query the xml data using the curl library and parse it
> > > according to the user's configuration using libxml2. I have worked
> > > on the top of curl-json plugin code and got this plugin to work.

Sounds interesting :) What do you plan to use this plugin for?

> > > I am proposing the following configuration for curl_xml:
> > >
> > > <Plugin curl_xml>
> > >    <URL "[some url]">
> > >        Instance "<instance-name>"
> > >        <xpath "<xpath1>">
> > >           Instance "<instance-name>" (Optional)
> > >           Type "<type>"
> > >        </xpath>
> > >        <xpath "<xpath2>">
> > >           Instance "<instance-name>" (Optional)
> > >           Type "<type>"
> > >        </xpath>
> > >   </URL>
> > >   <URL .....>
> > >      ......
> > >    </URL>
> > > </Plugin>

Looks okay to me. However, I'd expect XML to contain a lot of tabular
data in general. Wouldn't it make sense to make it possible to configure
columns for instance name and values. Something like:

  <XPath "/path/to/table[class=magic]">     # I don't know the XPath
    Instance "tr/th[class=type_of_magic]"   # syntax, so I'm making
    Values "tr/td[class=magic_level]"       # something up here.
    Type "magic_level"
    Table true
  </XPath>

Where:

  * The argumetn to "XPath" is an xpath which returns a base block in
    which to look further.
  * The arguments to "Instance" and "Values" are xpath expressions, too.
    They are relative to the base block. Of the elements returned, only
    the directly contained text is used. Nested blocks are ignored.
  * Values and instance names are matched using the position in the
    returned lists.
  * If the number of elements in the lists differ, a warning message is
    dispatched.

Does that sound reasonable or did I miss something?

> > > Does this plugin make sense?. I will be submitting the configure,
> > > Makefile and the documentation changes once this idea is approved.

Yeah, makes sense to me.

You don't need my approval for this, though: Whether or not I like the
plugin doesn't matter. As long as the code quality is high, the behavior
is consistent with the rest of collectd and the license is compatible
the plugin will be accepted. I haven't looked at your patch yet, but I
don't think there's gonna be a problem ;)

Regards,
-octo

[0] <http://collectd.org/wiki/index.php/Roadmap#cURL-XML_plugin>
-- 
Florian octo Forster
Hacker in training
GnuPG: 0x91523C3D
http://verplant.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20091221/46e8adbc/attachment.pgp 


More information about the collectd mailing list