munin plugin
authorTeodor Sigaev <teodor@sigaev.ru>
Mon, 4 Apr 2016 18:13:32 +0000 (21:13 +0300)
committerTeodor Sigaev <teodor@sigaev.ru>
Mon, 4 Apr 2016 18:13:32 +0000 (21:13 +0300)
munin.plugin/trinket [new file with mode: 0755]

diff --git a/munin.plugin/trinket b/munin.plugin/trinket
new file mode 100755 (executable)
index 0000000..c16a8b1
--- /dev/null
@@ -0,0 +1,63 @@
+#!/bin/sh
+# -*- sh -*-
+
+: << =cut
+
+=head1 NAME
+
+co2mon - Plugin to monitor Atom Pro for radiation level 
+
+=head1 NOTES
+
+
+=head1 CONFIGURATION
+
+The following environment variables are used by this plugin:
+
+ rad_warning  - Warning CO2 ppm (Default: 50)
+ rad_critical - Critical CO2 ppm (Default: 100)
+
+=head1 MAGIC MARKERS:
+
+ #%# family=auto
+ #%# capabilities=autoconf
+
+=cut
+
+. $MUNIN_LIBDIR/plugins/plugin.sh
+is_multigraph
+
+DATAFILE='/var/db/trinket/trinket.dat'
+
+print_values() {
+       rad=`/usr/bin/grep radlevel "$DATAFILE" | /usr/bin/sed -e 's/radlevel: //'`
+
+    echo 'multigraph rad'
+    echo "rad.value ${rad:-U}"
+}
+
+if [ "$1" = "autoconf" ]; then
+    if [ -s "$DATAFILE" ] ; then
+       echo yes
+    else
+       echo no
+    fi
+    exit 0
+fi
+
+if [ "$1" = "config" ]; then
+    echo 'multigraph rad'
+    echo "graph_title Radiation level, mkR/h"
+#    echo 'graph_args --upper-limit 3000 -l 0'
+    echo 'graph_vlabel mkR/h'
+#    echo 'graph_scale no'
+    echo 'graph_category sensors'
+    echo "rad.label Radiation level, mkR/h"
+    rad_warning=${rad_warning:-50}
+    rad_critical=${rad_critical:-100}
+    print_thresholds 'rad'
+
+    exit 0
+fi
+
+print_values