#! /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? # ## 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 location=$(printf '%s' "${0#*_}" | tr '_' '=') query_string="${location}&appid=${apikey}" plugin_name=$( basename $0 ) OWAPI=$( curl -s "http://api.openweathermap.org/data/2.5/weather?mode=xml&${query_string}") KELVIN_BIAS=273 CITY=$( expr "$OWAPI" : '.*\ FR EOF