#!/bin/sh
# http://exchange.munin-monitoring.org/plugins/alertme_power/details
#
# alertme_power relies on http://code.google.com/p/alertmepi/
# to have been installed and working
#
# 20110120 - update to use correct mixed case for AlertMe and remove cruft 
# left over from creating this plugin from another script
#
# add to the plugins-conf.d/munin so that it can read the /etc/alertme files
# [alertme_*]
#	user root


if [ "$1" = "config" ] ; then
	echo "graph_title AlertMe Keyfobs At Home"
	echo "graph_category sensors"
	echo "graph_info this graph shows AlertMe Keyfob present count"
	echo "graph_vlabel number"
	echo "KeyfobsAtHome.label number of keyfobs present"
	exit
fi


echo -n "KeyfobsAtHome.value "
KFC=`/usr/local/bin/alertmepi.pl -k | wc -l`

if [ $? -eq 0 ] ; then
 	echo $KFC 
else
	echo U
fi

# end alertme_power munin_plugin
