commit 7241a4ff6cdde07e472e08f801e4f8f6a7bc80d0 Author: Wolf Gratz Date: Mon Mar 8 18:33:19 2021 +0100 initial diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1377554 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.swp diff --git a/README.md b/README.md new file mode 100644 index 0000000..ce1e8f5 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +====== Munin wttr.in plugins ====== +===== Description ===== +These plugins will fetch weather data from wttr.in to display them in munin. + * temperature + * humidity + * precipitation + * wind speed + * barometric pressure + +===== Configuration ===== +By default, wttr.in will attempt to guess your location based on your IP address. I suggest you create a config in plugin-conf.d/ like this: + +``` +[wttr_*] + env.wttr_location Berlin +``` diff --git a/wttr_humidity b/wttr_humidity new file mode 100755 index 0000000..27a1ccd --- /dev/null +++ b/wttr_humidity @@ -0,0 +1,16 @@ +#!/bin/sh + +case $1 in + config) + cat <<'EOM' +graph_category environment +graph_title Humidity +graph_vlabel % +humidity.label humidity +graph_args -l 0 --upper-limit 100 +EOM + exit 0;; +esac + +printf "humidity.value " +curl -s https://wttr.in/${wttr_location}\?format="%h\n" 2>&1 | sed 's/\%//' diff --git a/wttr_precipitation b/wttr_precipitation new file mode 100755 index 0000000..bbd404b --- /dev/null +++ b/wttr_precipitation @@ -0,0 +1,16 @@ +#!/bin/sh + +case $1 in + config) + cat <<'EOM' +graph_category environment +graph_title Precipitation +graph_vlabel mm +precipitation.label precipitation +graph_args -l 0 +EOM + exit 0;; +esac + +printf "precipitation.value " +curl -s https://wttr.in/${wttr_location}\?format="%p\n" 2>&1 | sed 's/mm//' diff --git a/wttr_pressure b/wttr_pressure new file mode 100755 index 0000000..4b27b51 --- /dev/null +++ b/wttr_pressure @@ -0,0 +1,16 @@ +#!/bin/sh + +case $1 in + config) + cat <<'EOM' +graph_category environment +graph_title Pressure +graph_vlabel hPa +graph_scale no +pressure.label pressure +EOM + exit 0;; +esac + +printf "pressure.value " +curl -s https://wttr.in/${wttr_location}\?format="%P\n" 2>&1 | sed 's/hPa//' diff --git a/wttr_temperature b/wttr_temperature new file mode 100755 index 0000000..0475eb0 --- /dev/null +++ b/wttr_temperature @@ -0,0 +1,16 @@ +#!/bin/sh + +case $1 in + config) + cat <<'EOM' +graph_category environment +graph_title Temperature +graph_vlabel ° Celsius +temperature.label temperature +graph_args -l -50 --upper-limit 50 +EOM + exit 0;; +esac + +printf "temperature.value " +curl -s https://wttr.in/${wttr_location}\?format="%t\n" 2>&1 | sed 's/\°C//' | sed 's/\+//' diff --git a/wttr_wind b/wttr_wind new file mode 100755 index 0000000..62792a1 --- /dev/null +++ b/wttr_wind @@ -0,0 +1,16 @@ +#!/bin/sh + +case $1 in + config) + cat <<'EOM' +graph_category environment +graph_title Wind speed +graph_vlabel km/h +windspeed.label wind speed +graph_args -l 0 +EOM + exit 0;; +esac + +printf "windspeed.value " +curl -s https://wttr.in/${wttr_location}\?format="%w\n" 2>&1 | sed -r 's/^[^0-9]*([0-9]+).*$/\1/'