[collectd] curl_xml plugin ValuesFrom a dynamic list of childs ?

Coetsier, Antoine Antoine.Coetsier at veltigroup.com
Wed Oct 24 00:06:02 CEST 2012


Hello,

Is it at all possible to prevent having all childs explicitly written in
configuration as the list can change over time ?

my url from CloudStack outputs an XML with multiple childs, selecting each
child manually works using child[1] and then getting the values. How to
write a config that can adapt to an unknown list of childs ? from child[1]
to child[N] ?

I have tested different syntaxes (multiple ValuesFrom,Š ) to no effect.

Thank you for any help.

Conf snippet :
-----------------
<Plugin "curl_xml">
        <URL "URL">
	Host "CloudStack"
	Instance "Test"
	<XPath "/listhostsresponse">
		Type "counter"
		InstancePrefix "Count"
		ValuesFrom "count/text()"
	</XPath>
	<XPath "/listhostsresponse/host[1]">
		Type "bytes"
		InstancePrefix "MemoryUsed"
		ValuesFrom "memoryused/text()"
	</XPath>
	<XPath "/listhostsresponse/host[2]">
		Type "bytes"
		InstancePrefix "MemoryUsed"
		ValuesFrom "memoryused/text()"
	</XPath>
        </URL>
</Plugin>
-----------------




An example of the output XML to be parsed:
-----------------
<listhostsresponse cloud-stack-version="3">
	<count>8</count>
	<host>
		<id>70</id>
		<memoryused>11646344</memoryused>
	</host>
	<host>
		<id>71</id>
		<memoryused>1245679</memoryused>
	</host>
	<host>
		<id>72</id>
		<memoryused>24597373</memoryused>
	</host>
</listhostsresponse>
-----------------







--
Antoine









More information about the collectd mailing list