Zabbix has proven itself successful as an IT monitoring solution when there is a need to oversee the health of hundreds and thousands of servers. However, there is no reason to think that such a powerful system can only do just that – monitor computers. In the first such post today, we will try to uncover the potential of how Zabbix can be used in a multitude of different ways.

As the post title suggests, today we will setup Zabbix to monitor weather. There are many weather API’s out there, but two of them – Yahoo! Weather RSS Feed and Google Weather API – are equally convenient to get started with and require no registration to use. For the purposes of this post, we will use Yahoo! Weather, since it provides a bit more information.

To obtain a weather forecast from Yahoo!, we use an URL of the form, where location is a WOEID (see request summary for how to find yours) and units is either c for Celsius and metric units or f for Fahrenheit and English units.

For instance, the weather forecast for Riga, Latvia can be obtained by visiting the URL and looks as follows (stripped of irrelevant information and reformatted for brevity and clarify, respectively):

    <yweather:location city="Riga" country="Latvia"/>
    <yweather:units temperature="C" distance="km"
                    pressure="mb" speed="km/h" />
    <yweather:wind chill="16" direction="20" speed="20.92" />
    <yweather:atmosphere humidity="55" visibility="9.99"
                         pressure="982.05" />
    <yweather:astronomy sunrise="6:25 am" sunset="8:21 pm" />
      <yweather:condition text="Fair" code="34" temp="16"
                          date="Wed, 01 Sep 2010 12:50 am EEST" />
      <yweather:forecast day="Wed" date="1 Sep 2010" code="30"
                         low="11" high="17" text="Partly Cloudy" />
      <yweather:forecast day="Thu" date="2 Sep 2010" code="12"
                         low="10" high="12" text="Rain/Wind" />

Now that we know what information is out there, we need to create a template with corresponding items and triggers. The example template we have developed can be downloaded from here (right click to save as file) and can be seen on the following screenshots:

Items of Template_Weather

Triggers of Template_Weather

The triggers are designed to let you know whether there is going to be a cold or hot weather, according to the forecast. By creating actions for the weather triggers, you can receive email or SMS alerts, so that you always know what to wear and whether you need to take an umbrella with you!

The parsing of the weather XML is done with a Perl script that is run every hour by cron. The script uses zabbix_sender to send metrics to the server. You can download the script from here and adjust the first four variables to match your environment. As an example, the weather conditions for today in Riga, Latvia can be seen in “Latest data” below:

Conditions in Riga, Latvia

Unfortunately, what Zabbix does not currently allow you to do in an elegant way, is to receive weather forecasts, regardless of whether the forecast is problematic or not. The only way seems to be creating an action for a dummy trigger that will always be on. There is an issue, ZBXNEXT-415, about it on Zabbix bug tracker, and you can vote for it, if you need this possibility in the daily IT administration work.

This is it for this blog post. May you all have a good weather today!

Notify of
Newest Most Voted
Inline Feedbacks
View all comments
Paul Poetsma
Paul Poetsma
13 years ago

Why not add the Perl script as “External check” to the template? No need to add it to cron, just let Zabbix schedule the script. Btw, thank you for the script and template, I installed it and it works great. I added some graphs, for example to visualize the actual temperature and the wind chill temperature or the wind direction and speed.

13 years ago


Would love your thoughts, please comment.x