• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1103
  • Last Modified:

Cacti: Graphing XML data from HTTP GET

I have a MeteoHub device that connects to our weather station in the office and stores the sensor values from various hygrometers in our office. They have an HTTP data request model that seems to be pretty extensive in what you can request (located here: http://www.meteohub.de/joomla/index.php?option=com_docman&task=doc_download&gid=99&Itemid=29 ).

What I want to do is get some way of parsing this data from the MeteoHub in a Cacti data source so I can graph the temperature and ambient humidity in the office. I'd want to break down the data for the 4 sensors we have: thb0, th0, th5, and th6.

One caveat is that some of the sensors check in every 90 seconds and not every 60, so in order to poll the source every minute, it would have to request a broader time range in the HTTP GET and use only the most recent value.

Also, the data is stored on a filesystem in a plain-text document, so if accessing the log file and parsing for the data would be an easier path let me know. I can close this question and open a new one with that in mind.
Example XML return from the HTTP GET on http://192.168.2.151/meteolog.cgi?mode=data&type=xml&start=20090501001200&end=20090501001300
 
<logger>
  <THB date=20090501001207 id=thb0 temp=22.4 hum=51 dew=11.8 press=988.0 seapress=1011.5 fc=2>
  <TH date=20090501001209 id=th5 temp=21.5 hum=59 dew=13.2>
  <THB date=20090501001217 id=thb0 temp=22.4 hum=51 dew=11.8 press=988.0 seapress=1011.5 fc=2>
  <THB date=20090501001227 id=thb0 temp=22.4 hum=51 dew=11.8 press=988.0 seapress=1011.5 fc=2>
  <THB date=20090501001237 id=thb0 temp=22.4 hum=51 dew=11.8 press=988.0 seapress=1011.5 fc=2>
  <UV date=20090501001244 id=uv0 index=0.0>
  <THB date=20090501001247 id=thb0 temp=22.4 hum=51 dew=11.8 press=988.0 seapress=1011.5 fc=2>
  <THB date=20090501001257 id=thb0 temp=22.4 hum=51 dew=11.8 press=988.0 seapress=1011.5 fc=2>
</logger>

Open in new window

0
drbill1
Asked:
drbill1
1 Solution
 
ai_ja_naiCommented:
Cacti is not suited. You'd spend more time in customizing it to accept your parsed data than finding something simpler to fullfill your goal.
I suggest using a php to to parse the xml and then using php built in graphic functions to draw the graphs, storing the old data in a rdbms for historical purposes.

php parser: http://www.devpapers.com/article/61/
rdbms: http://www.sqlite.org/
simple graphics in php: http://articles.techrepublic.com.com/5100-10878_11-5092227.html
0
 
drbill1Author Commented:
Not a complete solution, but it set me down the right path.
0

Featured Post

 The Evil-ution of Network Security Threats

What are the hacks that forever changed the security industry? To answer that question, we created an exciting new eBook that takes you on a trip through hacking history. It explores the top hacks from the 80s to 2010s, why they mattered, and how the security industry responded.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now