/usr/share/munin/plugins/apc_envunit_ is in munin-plugins-core 2.0.19-3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | #!/bin/sh
# -*- sh -*-
: << =cut
=head1 NAME
apc_envunit_ - plugin to monitor temperature and humidity
=head1 APPLICABLE SYSTEMS
Hosts which can use SNMP to connect to an APC environmental unit
=head1 CONFIGURATION
The following environment variables are available
units - DNS names of environmental units
oid - OID Prefix for humidity probes
community - SNMP community to use to access the APC unit
The following shows a typical configuration:
[apc_envunit_*]
env.units foo.example.org bar.example.org
env.community 123secret
=head1 INTERPRETATION
Shows a graph with either temperature or humidity for a number of
environmental units.
=head1 MAGIC MARKERS
#%# family=auto
#%# capabilities=autoconf suggest
=head1 BUGS
None known. Should be snmp__apc_.
=head1 AUTHOR
Xavier Redon
=head1 LICENSE
Unknown
=cut
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"
fi
fi
UNITS=""
COMMUNITY="public"
SNMPGET=`which snmpget 2>/dev/null`
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}" ] ; then echo "no (no units to monitor)" ; exit 0 ; fi
if [ -z "$SNMPGET" -o ! -x "$SNMPGET" ] ; then
echo "no (no snmpget executable)"
exit 0
fi
for m in ${UNITS} ; do
if ping -c1 -q $m >/dev/null 2>&1 ; then continue ; fi
echo "no (can't reach $m)" ; exit 0
done
echo "yes" ; exit 0
fi
if [ "$1" = "suggest" ]; then
echo temperature
echo humidity
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
|