Planning your next vacation with Monitis

The power of Monitis and Monitis Monitor Manager M3

Monitis can monitor everything – and anything.

In the last article I’ve demonstrated some of Monitis Monitor Manager (M3) framework capabilities with parameter extraction from web pages.

M3 support parameter extraction via XML xpath, JSON path and also a simple regular expression.

In the following article I’ll demonstrate another handful of solid examples. The last ones will help you decide when to take your next vacation.

I suggest reading this previous article in the series before proceeding with reading.

Follow me, follow you

First and foremost – I must admit – I’m not a Twitter user.

It is very common today for businesses to have a Twitter account, twitting their latest news for the hungry followers with their latest advancements.

Stakeholders would usually follow the Twitter account in order to find out how much interest there is in their business. Yet again, Monitis & M3 come for the rescue.

Graphing results in Monitis combined with the brilliant JSON API Twitter provides enables us to easily graph the number of followers on a Twitter account:

Ouch we lost a follower!

This link provides the following JSON output (filtered and beautified):

 { ... "default_profile": false, "profile_sidebar_border_color": "BDDCAD", "time_zone": "Pacific Time (US & Canada)", "default_profile_image": false, "statuses_count": 931, "profile_use_background_image": true, "created_at": "Sun Nov 16 11:20:23 +0000 2008", "lang": "en", "verified": false, "favourites_count": 16, "friends_count": 1985, "profile_background_color": "36a5e5", "id": 17421289, "is_translator": false, "profile_background_image_url": "", "followers_count": 1950, ... } 

The M3 configuration for extracting that could have never been simpler, here is a snippet:

 <url></url> <metric name="Followers"> <type>integer</type> <uom>nr</uom> <json>{'followers_count'}</json> </metric> 

We simply specify the URL and the JSON path to the element we’re interested in.

Doing business with Yahoo!

It is only recently that I was exposed to the vast financial API Yahoo! provides.

In addition to impressive graphing capabilities Yahoo! also exports all financial data in a CSV (comma separated, spreadsheet like format).

SNP 500 can be graphed via the following link.

The Yahoo! API for obtaining the last closeout would be:

 # wget -q -O - "^GSPC&f=p" 1204.42 

Graphing that is simple as well with M3:

 <url>^GSPC&amp;f=p</url> <metric name="SNP 500 previous close"> <type>float</type> <uom>Points</uom> <regex>(.*)</regex> </metric> 

Yes, there is a bit of a learning curve dealing with Yahoo! Finance, however this page will help you extract the information you want.

Planning your next vacation

HotWire provides as well a very comprehensive API for obtaining hotel and flight prices. Monitoring the cheapest hotel you can book via Monitis and M3 is simple as any other parameter extraction.
I want to fly to Paris. I’ve been twice to France, but never to Paris.

 # wget -q -O - "" <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Hotwire> <Result> <HotelDeal> ... <City>Courbevoie</City> <CountryCode>FR</CountryCode> <FoundDate>2011-09-07T15:20:04-07:00</FoundDate> <CurrencyCode>USD</CurrencyCode> <Price>57.0</Price> ... </HotelDeal> </Result> </Hotwire> 

Please note you’ll have to register with HotWire if you want an API key. I concealed mine here for obvious reasons. To be honest $57 for a night in a hotel is pretty cheap, however, lets look for something cheaper by monitoring this price in Monitis. The configuration for graphing it is available in hotwire_sample.xml.
The xpath we’re interested in is:


Cheapest Hotel In Paris

When will my money buy more?

I’ve shown already how to extract stock data from Yahoo! Finance. But if SNP 500 or NASDAQ are on a peak, it doesn’t necessarily mean it’s a good time for a vacation in Paris.

Say your money in the bank is in USD and you want to spend some time in Paris, graphing the USD to EUR exchange rate can provide you with a good idea when it’s time to visit the Eiffel Tower:

The code is for this example is here.

Monitis can monitor anything! Follow us also on Twitter and GitHub.

Read more about Monitis Monitor Manager (M3) Framework: