Environment: Monitoring the weather or its forecast

  Home  Previous  Next

While the idea of monitoring the weather with BMC Performance Manager or PATROL probably sounds far fetched, it may often be a critical variable: cold temperatures and frozen roads impact how much time it will take FedEx to ship a box or high temperatures may take your air conditioning system down in your server room.

Principle

How do we manage to retrieve the current temperature in, for instance, Houston, Texas? The easiest way is to browse any weather Web site and ask for the weather in a given location.

For example, if we browse the Yahoo! Weather Web site and ask for Houston, TX, we get:

WeatherForecast

So, we will simply configure Monitoring Studio to ask for the weather for Houston, TX from the Yahoo! Weather Web site, and retrieve the temperature value (shown in the green box above). Monitoring Studio will send a Web request to the Yahoo! Web site every 2 minutes, extract the temperature value, and build a graph in the PATROL Console. This graph will generate alerts if the temperature becomes too cold or too hot.

BMC Performance Manager Monitoring Studio allows you to easily setup the monitoring of your local weather (or its forecast) in PATROL/BMC Performance Manager. In this example, we will use Monitoring Studio to extract the current temperature in Houston, Texas from the Yahoo! Weather Web page.

From the PATROL Console, we right-click the main Monitoring Studio icon > KM Commands > New > Web request analysis….

WebRequestAnalysis_Menu

The Web request analysis wizard appears. We enter the URL of the Yahoo! Weather Web page for Houston, Texas: http://weather.yahoo.com/forecast/USTX0617_f.html.

WebRequestAnalysis_URL

We use default values for other options and give an accurate name to the icon that is going to be created in the PATROL Console:

WebRequestAnalysis_Name

When we click Finish, a new icon is created in the PATROL Console representing the Web request analysis we have configured. Every 2 minutes (as set in the previous step), the configured Web request will be executed and the parameters of this icon will be refreshed. Once updated, the ReturnOutput parameter looks like this:

Results

Then, we are going to extract the current temperature value from the Web page. To do so, we create a new Numeric Value search to find this value. When we look at the contents of the page (as shown in the ReturnOutput parameter), we notice that the current temperature is in a simple line with the temperature value followed by ° (which is the HTML code for the degree symbol):

Extract

Thus, the only thing we must do to retrieve the temperature in Houston is to configure Monitoring Studio to look for the line that begins with a numeric value followed by “°” and extract the value that is before “°”.

We right-click the previously created “Yahoo! Weather: Houston, TX” icon > KM Commands > New > Numeric value search…. The Numeric Value search wizard appears. In the first step, we configure the numeric value search to look only into the lines that match the ^[0-9]+°$ regular expression (for more information about regular expressions, please read Monitoring Studio online help and documentation):

NumericValueExtract_Value

Then we configure Monitoring Studio to retrieve the numeric value in this line, which is before the “°” HTML tag:

NumericValueExtract_Location

Finally, we set alert thresholds for this temperature value and give a name to the icon that will be created in the PATROL Console:

Alarm

Once done, the temperature monitoring in Houston, Texas looks like the following screenshot in the PATROL Console:

Graph

This temperature monitoring can be easily brought into BMC Reporting, BMC Impact Manager or any component of the BMC Software framework.

Summary

Here is a summary of what we have done to set up the monitoring of the weather in Houston, Texas in our PATROL Console:

Configure a Web request analysis for the Yahoo! Weather Web site (http://weather.yahoo.com/forecast/USTX0617_f.html).
Configure a Numeric Value search to retrieve the temperature value as located in a simple line like: 49°.

Note: We could have configured Monitoring Studio to retrieve other weather information (humidity, wind speed, 1 day forecast, etc.) or from another source (MSN Weather, www.weather.com, etc.)