Forum Discussion

Jeff_Woeber's avatar
8 years ago

Monitor weather with the WeatherUnderground.com API

This datasource uses the Weather Underground API to monitor weather conditions for multiple locations. This will require a Free Weather Underground API key.  This key should be added as a device properties weather.api.key

The datasource exchange locator is KT6NLM

I have an example setup to monitor Austin, TX, Jupiter, FL, and Santa Barbara, CA

To get started, add a new device under Expert mode and in the “Link to a URL” box add in api.wunderground.com

 

Once the URL has been added to LogicMonitor click on “Add Monitored Instance”.  Add the weatherdeatails datasource and an instance of your choice.    In my example I used TX/austin.

 

You can add in other locations under the instances tab.

 

For a better understanding on what the Instances Values should be, a complete API URL for Santa Barbara is

http://api.wunderground.com/api/Your_Key/conditions/q/ca/santa_barbara.json

The data source is using an HTTP GET appended to the host URL

GET /api/##weather.api.key##/conditions/q/##WILDVALUE##.json HTTP/1.1

Host:##HOSTNAME##

The instance values is just the STATE/city part of the API URL.  

 

 

 


 

  • I'm getting an error when I try to import this "Unknown error"

     
  • This is pretty cool, I was able to get it working with the DataSource library out on Exchange.  Has anyone tried any of the other APIs with wunderground.com?  I've been trying to get alerts (https://www.wunderground.com/weather/api/d/docs?d=data/alerts&MR=1) pulled in via an EventSource figuring the data coming over will be more of a text format rather than numbers...but haven't had much luck.

    -Mitch

  • They have actually stopped the free api service, may need to find another weather API to use. 

  • @Mcooner - that's a bummer. It looks like OpenWeatherMap has a free API, but the datasources will almost certainly need to be re-written for the different API.

    Edit/ Update: Since I suggested it, I went ahead and made the new one (locator code GRZDYN) using the OpenWeatherMap API (linked above.) Per the previous efforts of the illustrious @Jeff.Woeber, cities are added in a similar fashion, only using zip codes instead of city names - you will need a free API key set as property owm.api.key :

    *FYI, the API is rate limited to 60 calls per hour, so if you have more than three cities added, you'll need to increase the polling interval from 3 minutes to something less often...

  • Hey Kerry this is cool, can you share how you put together the DataSource for OpenWeatherMap?

     

    Thanks

  • @Jason Miller - sure, it uses our 'WEBPAGE' collection method and JSON post-processing to query the API URL and harvest the data. Here's a screenshot of the important DataSource definition bits:

  • This is very cool!  I added the weather condition datapoint to my imported copy as that is often a critical correlation item ($.weather[0].id) for site outages.  The trick will be building out a large enough legend for those (https://openweathermap.org/weather-conditions).  I am also trying to figure out how this data can be effectively shared and displayed across multiple clients without excessive manual maintenance.  May have to use the LM API to maintain dashboards, unclear yet.  It would be very helpful if you could tie this to the map widget...