Search the Community
Showing results for tags 'jsoup'.
Found 1 result
Q: When's the best time to buy a new computer? A: Yesterday or tomorrow. If you bought it yesterday you'd have been benefiting from a shiny, new, faster computer and could have got more done already. Wait until tomorrow and there'll be a better, faster, cheaper* model out so you'll get more for your money. *At the very least, two out of three aint bad, as the famous philosopher Meatloaf once wrote. If you're considering purchasing from Apple, however, there exists solid buying guidance courtesy of https://buyersguide.macrumors.com/ - an excellent source of data relating to each current product, how long since the current version was released, average time between releases, etc. Here's a DataSource that uses Groovy's JSoup parser to pull all of those useful metrics out of the HTML and present them in graphs within LogicMonitor, and of course offers the option to alert on, for example, advice to "buy now" vs waiting for the next refresh. As saved it's applied to couple of (my) Collector machines, explicitly by their display names; you will need to change this most likely. I suggest applying it to one or two devices only within your account; collector devices are ideal. Collection interval is set to 4 hours because the data doesn't change very often (once per day plus a change on the release of each new product). Also, I don't want to annoy macrumors.com and find my collector IPs blocked from connecting to their site, and neither do you, so be sure to avoid applying it to loads of devices or setting it for an unnecessarily-high-frequency collection interval. Active Discovery runs daily to detect new product lines (and redundant products will disappear as you'd imagine. Data graphed is an interpretation of the Buy/Neutral/Caution/Wait statuses MacRumors lists, and a 'days' graph showing the age of the current version, the average age between releases, and the ages of the previous three (at most) versions of the product, for comparison. All releases listed by MacRumors are added as an Instance Level Property. Caveat: Obviously, if MacRumors restructure their buyers guide page, this will break. v1.2.0: 4X69F7 Yes, it's a bit of fun (although you could use it to guide buying cycles... ish... I guess), but more usefully it's a pair of example scripts that will demonstrate how to parse data from a well-structured HTML page, using selector paths; feel free to take the concepts and apply it to other HTML outputs within your environments - as I always say about LogicMonitor, the only two limitations on what we can monitor are what data something exposes, and your own imagination. Enjoy!