|
Server : Apache/2.2.2 (Fedora) System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686 User : apache ( 48) PHP Version : 5.2.9 Disable Function : NONE Directory : /usr/local/src/munin-1.2.6/node/node.d/ |
Upload File : |
#!/bin/sh
#
# Plugin to monitor APC environmental units (temperature/humidity)
#
# Usage: Copy or link into /etc/munin/node.d/
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# Config variables:
#
# units - DNS names of environmental units
# oid - OID Prefix for humidity probes
# community - Community to use to access the APC unit
#
#
# Configuration for temperature or humidity probes
#
type=`echo $0 | sed -e 's/.*_\(.*\)/\1/'`
if [ "${type}" = temperature ] ; then
TOID="enterprises.318.1.1.10.3.13.1.1.3"
NAME="temperature"
LABEL="Celsius Degrees"
LETTER="t"
else
if [ "${type}" = humidity ] ; then
TOID="enterprises.318.1.1.10.3.13.1.1.6"
NAME="humidity"
LABEL="Humidity %"
LETTER="h"
else
exit 1
fi
fi
UNITS=""
COMMUNITY="public"
SNMPGET=`which snmpget`
if [ "$units" ]; then UNITS=$units ; fi
if [ "$oid" ]; then TOID=$oid ; fi
if [ "$community" ]; then COMMUNITY=$community ; fi
SNMPOPTS="-Ov -Oq -v1 -c ${COMMUNITY}"
if [ "$1" = "autoconf" ]; then
if [ -z "${UNITS}" -o -z "${SNMPGET}" ] ; then echo "no" ; exit 1 ; fi
for m in ${UNITS} ; do
if ping -c1 -q $m >/dev/null 2>&1 ; then continue ; fi
echo "no" ; exit 1
done
echo "yes" ; exit 0
fi
if [ "$1" = "config" ]; then
echo "graph_title Environmental units (${NAME} probes)"
echo "graph_vlabel ${LABEL}"
for m in ${UNITS} ; do
mm=`echo ${m} | tr '-' '_'`
echo "${mm}_${LETTER}1.label $m ${NAME} #1"
echo "${mm}_${LETTER}2.label $m ${NAME} #2"
done
exit 0
fi
for m in ${UNITS} ; do
v1=`${SNMPGET} ${SNMPOPTS} $m ${TOID}.1`
v2=`${SNMPGET} ${SNMPOPTS} $m ${TOID}.2`
mm=`echo ${m} | tr '-' '_'`
echo "${mm}_${LETTER}1.value $v1"
echo "${mm}_${LETTER}2.value $v2"
done