diff --git a/plugins/weather/openweather_ b/plugins/weather/openweather_ new file mode 100644 index 00000000..47b1c128 --- /dev/null +++ b/plugins/weather/openweather_ @@ -0,0 +1,139 @@ +#! /bin/sh +# Inspired by https://github.com/cmur2/munin-openweather +# Steve Schnepp + +# This part is taken from the original plugin +# Example usage: +# Do +# ln -s /path/to/openweather_ openweather_ +# where is either a search query "q_Paris" or +# or an id search "id_2988507" +# +# These parameters translate directly into a URL formed like this: +# http://api.openweathermap.org/data//weather? +# + +query_string=$(printf '%s' "${0#*_}" | tr '_' '=') +TMPFILE=$(mktemp) +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 + +CITY=$(fgrep " + + + + FR + + + + + + + + + + + + + + + +EOF