Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Nov 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Please help (tatal noob)

    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.
    Code:
      
    <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
    Last edited by Alex Vincent; 11-12-2008 at 01:21 AM. Reason: Adding code tags

  • #2
    New to the CF scene
    Join Date
    Nov 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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/HTT...ion-config.xml


  • #3
    Regular Coder byuhobbes85's Avatar
    Join Date
    Oct 2006
    Location
    Ames, Iowa, USA
    Posts
    116
    Thanks
    9
    Thanked 4 Times in 4 Posts
    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?
    -- </byuhobbes>

  • #4
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by b-boy View Post
    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/HTT...ion-config.xml

    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •