From: Teodor Sigaev Date: Mon, 4 Apr 2016 18:13:32 +0000 (+0300) Subject: munin plugin X-Git-Url: http://sigaev.ru/git/gitweb.cgi?a=commitdiff_plain;h=8cbe60be9b46ed1bd7aa695ed1be732524994d7d;p=trinked.git munin plugin --- diff --git a/munin.plugin/trinket b/munin.plugin/trinket new file mode 100755 index 0000000..c16a8b1 --- /dev/null +++ b/munin.plugin/trinket @@ -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