2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

Switch to metric system, get rid of kelvin offset

Improved readability
Revert env. var. name change
This commit is contained in:
kaliko 2017-05-30 12:38:45 +02:00
parent 8893cfa8a1
commit 7e0a33e40f

View File

@ -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" : '.*\<city.*name=\"\(.*\)\"><coord.*' )
@ -38,7 +35,6 @@ then
graph_category sensors
graph_info This graph show the temperature in ${CITY}
temp_avg.label avg
temp_avg.cdef $KELVIN_BIAS,-
multigraph $plugin_name.temp
graph_title Temperature in ${CITY}
@ -46,11 +42,8 @@ then
graph_category sensors
graph_info This graph show the temperature in ${CITY}
temp_avg.label avg
temp_avg.cdef $KELVIN_BIAS,-
temp_min.label min
temp_min.cdef $KELVIN_BIAS,-
temp_max.label max
temp_max.cdef $KELVIN_BIAS,-
multigraph $plugin_name.humidity
graph_title Humidity in ${CITY}
@ -75,7 +68,7 @@ then
multigraph $plugin_name.wind_direction
graph_title Wind direction in ${CITY}
graph_vlabel m/s
graph_vlabel direction
graph_category sensors
graph_info This graph show the wind direction in ${CITY}
direction.label wind direction