View previous topic :: View next topic |
Author |
Message |
adamneal
Joined: 13 Aug 2006 Posts: 7
|
Posted: Sun Aug 13, 2006 4:37 am Post subject: RSS parser script |
|
|
Hello,
Firstly apologies if I've posted this in the wrong place.
I've just spent an hour or so putting together a PHP class that will parse the RSS feed from hyperspin. I thought I would post it here for others to use as I've seen a few questions asking how to do it. The class provides the basic fields from the RSS feed and also provides the following:
Total outages (curr month/prev month/all time)
Total downtime (curr month/prev month/all time)
Averages across all servers:
Uptime (curr month/prev month/all time)
Downtime (curr month/prev month/all time)
Outages (curr month/prev month/all time)
Examples of the data produced can be seen at:
Example report using a mocked up rss feed to simulate multiple servers
My live feed (only one server hence the need for a mocked up report)
My live feed integrataed into the site
The mocked up report uses fabricated data so the percentage numbers wont necessarily be right but the calculated averages based on this data are correct.
The example included should be self explanatory from comments in the code. If no URL is set it uses the Hyperspin Testdrive feed, however this feed does not provide all the data so you may notice some missing blocks and PHP notices in your error log. To stop these simply remove the missing statistics from the display section in reportExample.php.
This code is free for anyone to use, I would appreciate it if you would leave the headers intact though. Any comments/suggestions for improvements are greatly received either by email (found in the source) or on here. If you require extra guidance in the use of this then it's probably best to post here so all users benefit. The code has been tested and works as far as I can tell, however I'm only human so it is possible there may be bugs present Please let me know if you find any.
Adam
Files:
http://www.amnwebtech.co.uk/hyperspin/rssParser.tar.gz
http://www.amnwebtech.co.uk/hyperspin/rssParser.zip
(Edit: Added link to the report integrated into the site)
Last edited by adamneal on Sat Aug 19, 2006 1:23 pm; edited 1 time in total |
|
Back to top |
|
|
choonkeng Site Admin
Joined: 11 Sep 2005 Posts: 321
|
Posted: Sun Aug 13, 2006 5:24 am Post subject: |
|
|
Dear Adam,
Thank you so much for sharing your work. Many members here will find it useful, so I made it sticky
Thanks again. |
|
Back to top |
|
|
adamneal
Joined: 13 Aug 2006 Posts: 7
|
Posted: Sun Aug 13, 2006 5:35 am Post subject: |
|
|
Not a problem choonkeng. Would it be possible to turn on all the options on the testdrive report? This would allow me to show a more meaningful example than the one I mocked up.
Adam |
|
Back to top |
|
|
choonkeng Site Admin
Joined: 11 Sep 2005 Posts: 321
|
Posted: Sun Aug 13, 2006 6:03 am Post subject: |
|
|
Adam,
I would love to help, but turning on all options will make the sample report too verbose and hard to read, so I prefer to leave it that way.
May I suggest you also add the notice about possible missing blocks and PHP notices into reportExample.php, right before new hyperspinRSSParser(). This way, other users are warned and they can experiment with their own reports to see the full capability of your script.
Thanks. |
|
Back to top |
|
|
adamneal
Joined: 13 Aug 2006 Posts: 7
|
Posted: Sun Aug 13, 2006 6:17 am Post subject: |
|
|
Ok, no problem. I've made the changes you suggested to the source code |
|
Back to top |
|
|
UH-Matt
Joined: 28 Feb 2007 Posts: 2
|
Posted: Wed Feb 28, 2007 2:06 am Post subject: |
|
|
Adam
Any chance you could help me adjust this script?
I want to add a "click here" column to provide a link to each servers public report.
Any help appreciated... im no good with PHP.. |
|
Back to top |
|
|
adamneal
Joined: 13 Aug 2006 Posts: 7
|
Posted: Wed Feb 28, 2007 4:53 am Post subject: |
|
|
Matt,
Not a problem, I've sent you a PM back. I'll probably post the changes on here as I think it will be useful for most people |
|
Back to top |
|
|
adamneal
Joined: 13 Aug 2006 Posts: 7
|
Posted: Mon Jul 23, 2007 11:13 am Post subject: New version |
|
|
Hi everyone,
I've updated hyperspinRSSParser.class.php as it had a bug for when the downtime values went over one hour. I'd suggest updating to the latest version, the links in the first post now point to the latest files
Adam |
|
Back to top |
|
|
choonkeng Site Admin
Joined: 11 Sep 2005 Posts: 321
|
Posted: Mon Jul 23, 2007 11:23 am Post subject: |
|
|
Thanks Adam, your script has benefited many people |
|
Back to top |
|
|
adamneal
Joined: 13 Aug 2006 Posts: 7
|
Posted: Mon Jul 23, 2007 11:29 am Post subject: |
|
|
Not a problem, I probably should have added that the notes field is now included in the parsing as well, the example file has been updated to show how to use it.
Enjoy! |
|
Back to top |
|
|
UH-Matt
Joined: 28 Feb 2007 Posts: 2
|
Posted: Wed Aug 29, 2007 10:20 am Post subject: |
|
|
Adam thanks for your work on this.
Its fantastic! |
|
Back to top |
|
|
adamneal
Joined: 13 Aug 2006 Posts: 7
|
Posted: Mon Jun 09, 2008 8:07 am Post subject: Update |
|
|
I've made a small update to the script so that the Average results that are returned by the RSS feed aren't counted as an actual server. If people are updating you just need to copy the hyperspinRSSParser.class.php to the includes folder
Adam |
|
Back to top |
|
|
choonkeng Site Admin
Joined: 11 Sep 2005 Posts: 321
|
Posted: Mon Jun 09, 2008 12:10 pm Post subject: |
|
|
Thanks so much, Adam. |
|
Back to top |
|
|
|