From f07be516b79eaa8bd6b8a8285a8c01eba4230233 Mon Sep 17 00:00:00 2001 From: obma Date: Tue, 13 Oct 2015 17:48:04 +0200 Subject: [PATCH] p: openweather_: Add OpenWeather API Key OpenWeather needs you to use an API key since Oct 9 2015. Therefore I added env.apikey. To get a key just register at OpenWeather. --- plugins/weather/openweather_ | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/weather/openweather_ b/plugins/weather/openweather_ index 47b1c128..bbd3c7a4 100644 --- a/plugins/weather/openweather_ +++ b/plugins/weather/openweather_ @@ -13,6 +13,11 @@ # http://api.openweathermap.org/data//weather? # +## From Oct 9 2015 OpenWeather needs you to register and get an APIKEY +# include this key by setting 'env.apikey' in munin plugin config, i.e.: +# [openweather_*] +# env.apikey XYZ + query_string=$(printf '%s' "${0#*_}" | tr '_' '=') TMPFILE=$(mktemp) trap 'rm -f $TMPFILE' EXIT @@ -20,7 +25,7 @@ trap 'rm -f $TMPFILE' EXIT # API returns temp in K, we have to convert it in C KELVIN_BIAS=273 -curl -s "http://api.openweathermap.org/data/2.5/weather?mode=xml&${query_string}" > $TMPFILE +curl -s "http://api.openweathermap.org/data/2.5/weather?mode=xml&${query_string}&APPID=${apikey}" > $TMPFILE CITY=$(fgrep "