Ad Widget

Collapse

Pulling in web data from an html or xml page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Apathy
    Junior Member
    • Sep 2015
    • 3

    #1

    Pulling in web data from an html or xml page

    So I've tried a few things but I keep getting error messages so im not sure if im doing it correctly or not.

    Essentially I have an application that out puts data into an xml webpage, I would like to graph/consolidate this data with the use of zabbix.

    My problem is im not sure exactly how to do this, I've searched online but im not sure if zabbix can do this or not.

    The web page is an xml file that looks like this:

    <low>100</low>
    <peak>122</peak>

    my goal is to pull these numbers into a graph and pull data from it maybe every 2 minutes.
    Anyone know if this is possible?
  • jamesNJ
    Senior Member
    • Jun 2015
    • 103

    #2
    You would probably do this with a script or a UserParamater. You would write a small script, possibly with 'curl' and pull out the items you were interested in.

    However if you already have a process that generates the XML, it might be easier to augment that code to call zabbix_sender to send the data to zabbix server as well.

    Comment

    • Apathy
      Junior Member
      • Sep 2015
      • 3

      #3
      What I have found so far

      So I ended up creating an item to store the values and got it to work somewhat (in Zabbix go to configuration - > hosts -> items ). Sadly it ignores the place after the decimal place, anytime I bring in a decimal into zabbix it freaks out and states that the value its receiving isnt a number. (Maybe its because its receiving a decimal number and trying to convert it into a decimal a 2nd time to store it? I'm not quite sure yet).

      I typed this into the "key" field.
      web.page.regexp[111.111.111.111,path/to/memStats,port#,"free[0-9]+)",,\1]

      All that's on the webpage(tested with an XML page and an html page) is:

      This XML file does not appear to have any style information associated with it. The document tree is shown below.
      <memory>
      in-use:1538.25 free:496.75 total:2035.
      </memory>

      So by using the regex expression "free[0-9]+)" we are able to get only the numbers prior to decimal places for the "free:496.75", 496 gets pulled into zabbix. I was able now able to grab the total and in-use numbers and graph them to show how the database is using memory. Though sadly its off by anywhere by 0.01-0.99 of a Megabyte because I cant pull in decimals for a weird reason.

      So at this point im curious about how to get decimal values into zabbix? Does anyone know? Thanks in advance!

      Comment

      Working...