From 34413f21676a1dbdd1d55f9075a0f4682b9d5cfe Mon Sep 17 00:00:00 2001 From: Alexander Sukhov Date: Wed, 2 Sep 2015 17:33:39 +0300 Subject: [PATCH] Add munin plugins --- graph/munin/co2mon | 57 +++++++++++++++++++++++++++++++++++++++++ graph/munin/co2mon_temp | 57 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 114 insertions(+) create mode 100755 graph/munin/co2mon create mode 100755 graph/munin/co2mon_temp diff --git a/graph/munin/co2mon b/graph/munin/co2mon new file mode 100755 index 0000000..c25d19f --- /dev/null +++ b/graph/munin/co2mon @@ -0,0 +1,57 @@ +#!/bin/sh +# -*- sh -*- + +: << =cut + +=head1 NAME + +co2mon - Plugin to monitor MT8057 (RAD-0301) CO2 ppm values. + +=head1 NOTES + + +=head1 CONFIGURATION + +The following environment variables are used by this plugin: + + warning - Warning CO2 ppm (Default: 800) + critical - Critical CO2 ppm (Default: 1200) + +=head1 MAGIC MARKERS: + + #%# family=auto + #%# capabilities=autoconf + +=cut + +. $MUNIN_LIBDIR/plugins/plugin.sh + +print_values() { + co2=$(dbus-send --system --dest=io.github.dmage.CO2Mon --type=method_call --print-reply /io/github/dmage/CO2Mon io.github.dmage.CO2Mon.GetCO2 | grep -F uint16 | awk '{print $2}' ) + [ ! -z "${co2}" ] && echo "co2.value ${co2}" +} + +if [ "$1" = "autoconf" ]; then + if [ -z "$(print_values)" ] ; then + echo no + else + echo yes + fi + exit 0 +fi + +if [ "$1" = "config" ]; then + echo "graph_title CO2 ppm" +# echo 'graph_args --upper-limit 3000 -l 0' + echo 'graph_vlabel ppm' +# echo 'graph_scale no' + echo 'graph_category sensors' + echo "co2.label CO2 ppm" + warning=${warning:-800} + print_warning co2 + critical=${critical:-1200} + print_critical co2 + exit 0 +fi + +print_values diff --git a/graph/munin/co2mon_temp b/graph/munin/co2mon_temp new file mode 100755 index 0000000..3204e7d --- /dev/null +++ b/graph/munin/co2mon_temp @@ -0,0 +1,57 @@ +#!/bin/sh +# -*- sh -*- + +: << =cut + +=head1 NAME + +co2mon_temp - Plugin to monitor MT8057 (RAD-0301) CO2 temperature values. + +=head1 NOTES + + +=head1 CONFIGURATION + +The following environment variables are used by this plugin: + + warning - Warning temp (Default: 30) + critical - Critical temp (Default: 35) + +=head1 MAGIC MARKERS: + + #%# family=auto + #%# capabilities=autoconf + +=cut + +. $MUNIN_LIBDIR/plugins/plugin.sh + +print_values() { + temp=$(dbus-send --system --dest=io.github.dmage.CO2Mon --type=method_call --print-reply /io/github/dmage/CO2Mon io.github.dmage.CO2Mon.GetTemperature | grep -F double | awk '{print $2}' ) + [ ! -z "${temp}" ] && echo "temp.value ${temp}" +} + +if [ "$1" = "autoconf" ]; then + if [ -z "$(print_values)" ] ; then + echo no + else + echo yes + fi + exit 0 +fi + +if [ "$1" = "config" ]; then + echo "graph_title Temperature" +# echo 'graph_args --upper-limit 100 -l -10' + echo 'graph_vlabel Degreess Celsius' +# echo 'graph_scale no' + echo 'graph_category sensors' + echo "temp.label temp" + warning=${warning:-30} + print_warning temp + critical=${critical:-35} + print_critical temp + exit 0 +fi + +print_values