From 7e0a33e40f79eef844903c848550bf12dda11911 Mon Sep 17 00:00:00 2001 From: kaliko Date: Tue, 30 May 2017 12:38:45 +0200 Subject: [PATCH] Switch to metric system, get rid of kelvin offset Improved readability Revert env. var. name change --- plugins/weather/openweather_ | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/plugins/weather/openweather_ b/plugins/weather/openweather_ index cce41ab5..1aa3b7e4 100755 --- a/plugins/weather/openweather_ +++ b/plugins/weather/openweather_ @@ -16,16 +16,13 @@ ## 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.owapikey XYZ +# env.apikey XYZ -query_string=$(printf '%s' "${0#*_}" | tr '_' '=') -query_string="$query_string&appid=$owapikey" +location=$(printf '%s' "${0#*_}" | tr '_' '=') +query_string="${location}&appid=${apikey}&units=metric" plugin_name=$( basename $0 ) OWAPI=$( curl -s "http://api.openweathermap.org/data/2.5/weather?mode=xml&${query_string}") -# API returns temp in K, we have to convert it in C -# &units=metric would change that ;-) -KELVIN_BIAS=273 CITY=$( expr "$OWAPI" : '.*\