This commit is contained in:
2021-03-08 18:33:19 +01:00
commit 7241a4ff6c
7 changed files with 97 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*.swp

16
README.md Normal file
View File

@@ -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
```

16
wttr_humidity Executable file
View File

@@ -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/\%//'

16
wttr_precipitation Executable file
View File

@@ -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//'

16
wttr_pressure Executable file
View File

@@ -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//'

16
wttr_temperature Executable file
View File

@@ -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/\+//'

16
wttr_wind Executable file
View File

@@ -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/'