[collectd] curl_xml plugin

Amit Gupta amit.gupta221 at gmail.com
Thu Jan 7 14:14:30 CET 2010


On Wed, Dec 30, 2009 at 6:40 PM, Amit Gupta <amit.gupta221 at gmail.com> wrote:

> On Tue, Dec 29, 2009 at 9:23 PM, Sebastian Harl <sh at tokkee.org> wrote:
>
> I was thinking about the implementation of the suggested configuration and
> it seems that the implementation can be simpler if we consider the following
> approach:
>
> The evaluation of the <base_xpath> (i.e argument to the XPATH element) will
> return either of the following:
>    a.) Single result: This can be assumed as "Table" false case. The
> relative xpath expression(s) in "Values" is/are always expected to return
> one text node/attribute result.
>    b.) Multiple results : This can be assumed as "Table" true case.
> "Instance" xpath expression will be evaluated and result(s) will be stored
> in a list.  Multiple results will be iterated and the relative xpath(s) in
> "Values" will be evaluated relative to each of the result (node) [the
> result(s) of the relative xpath(s) can be dispatched to the rrd file at the
> same time]. The relative xpath expression(s) in "Values" is/are always
> expected to return one text node/attribute result.
>
> Do note that "Table" won't be required since single/multiple result(s) of
> the <base_xpath> evaluation can be used for the same as described above.
>
> Does this make sense?. Let me know if something is unclear.
>

Do find the curl_xml.c source file attached. The implementation is done as I
suggested in my previous mail.
The supported configuration is as follows:
<xpath "/path/to/node(s)">
   InstancePrefix "test" # optional
   Instance "path/to/textnode"  # optional if base xpath expression returns
single result i.e one matching node
   Values "path/to/textnode1"  "path/to/textnode2"
   Type "magic_level"
 </xpath>

I have done some level of testing to make sure plugin is working. If someone
is interested in testing/trying the plugin, do the following:
- apply the attached patch on the 4.9.0 branch
- copy the attached curl_xml.c to the collectd-4.9.0/src
- run autconf to generate new configure script containing changes to build
curl_xml plugin
- build and install collectd (make && make install)

Do let me know if anyone has problem building/running the plugin.

Any comments/suggestions are welcome.

Regards
Amit

>
> Regards
> Amit
>
>>
>> Cheers,
>> Sebastian
>>
>> --
>> Sebastian "tokkee" Harl +++ GnuPG-ID: 0x8501C7FC +++ http://tokkee.org/
>>
>> Those who would give up Essential Liberty to purchase a little Temporary
>> Safety, deserve neither Liberty nor Safety.         -- Benjamin Franklin
>>
>>
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.9 (GNU/Linux)
>>
>> iEYEARECAAYFAks6JgcACgkQEFEKc4UBx/zbtQCfWIIVzQr9nhm1sHZPpedUkmRV
>> W7AAmwfaoj4/EhrGveBDh7yCbbJ7EUVv
>> =NM8M
>> -----END PGP SIGNATURE-----
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.verplant.org/pipermail/collectd/attachments/20100107/a08e71bf/attachment-0001.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: curl_xml.c
Type: text/x-csrc
Size: 24683 bytes
Desc: not available
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20100107/a08e71bf/attachment-0001.c 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: collectd-4.9.0-mine.patch
Type: text/x-patch
Size: 12490 bytes
Desc: not available
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20100107/a08e71bf/attachment-0001.bin 


More information about the collectd mailing list