...

View Full Version : Please help (tatal noob)



b-boy
11-11-2008, 08:55 AM
Hi all

I hope you can help me as I have no idea what I’m doing when it comes to XML . I am trying to modify some code (OpenNMS HTTP collector) to collect stats from a webpage.

The example code they give me uses a matches statement to populate the var by looking for a string and pumping what’s next to it into a var.


<http-datacollection-config
xmlns:http-dc="http://xmlns.opennms.org/xsd/config/http-datacollection"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.opennms.org/xsd/config/http-datacollection http://www.opennms.org/xsd/config/http-datacollection-config.xsd"
rrdRepository="/opt/opennms/share/rrd/snmp/" >
<http-collection name="weather">
<rrd step="300">
<rra>RRA:AVERAGE:0.5:1:2016</rra>
<rra>RRA:AVERAGE:0.5:12:1488</rra>
<rra>RRA:AVERAGE:0.5:288:366</rra>
<rra>RRA:MAX:0.5:288:366</rra>
<rra>RRA:MIN:0.5:288:366</rra>
</rrd>
<uris>
<uri name="weather-station">
<url path="/"
virtual-host="www.example.com"
matches="(?s).*?Temperature.*?3366FF">([0-9\.]+).*?Humidity.*?3366FF">([0-9]+)
.*?Barometer.*?3366FF">([0-9\.]+).*?Wind\sChill.*?3366FF"><small>([0-9\.]+)
.*?Heat\sIndex.*?3366FF"><small>([0-9\.]+).*"
response-range="100-399" >
</url>
<attributes>
<attrib alias="wsTemperature" match-group="1" type="gauge32"/>
<attrib alias="wsHumidity" match-group="2" type="gauge32"/>
<attrib alias="wsBarometer" match-group="3" type="gauge32"/>
<attrib alias="wsWindChill" match-group="4" type="gauge32"/>
<attrib alias="wsHeatIndex" match-group="5" type="gauge32"/>
</attributes>
</uri>
</uris>
</http-collection>
</http-datacollection-config>


My problem is the data I want to collect from a web page is displayed like this

“1,2,3,4,0.2,0.4,0.8,1000,2000”

So there is no key word to search for , how would I go about pumping that data into the var? It looks like it might work with an array or something but i have no idea..

Thanks in advance
b

b-boy
11-11-2008, 09:34 AM
Hi again

I just wanted to give you the link to the OpenNMS page icase you need more details...

http://www.opennms.org/index.php/HTTP_Collector#http-datacollection-config.xml

:thumbsup:

byuhobbes85
11-26-2008, 01:59 AM
Some clarification would be useful. It's not clear what data you have and what you want to do with that data. After reading after your post a few times, I'm still not sure whether the XML file you provided is the data you need to manipulate or whether you need to manipulate your data to match the format. I also do not understand what you need to do with the comma delimited values you showed.

Clarification please?

oesxyl
11-26-2008, 04:47 PM
Hi again

I just wanted to give you the link to the OpenNMS page icase you need more details...

http://www.opennms.org/index.php/HTTP_Collector#http-datacollection-config.xml

:thumbsup:
this is not a xml problem, is java or something else. Ask one of the moderators to move the thread if you want an answer.

regards



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum