~ubuntu-branches/ubuntu/gutsy/munin/gutsy

« back to all changes in this revision

Viewing changes to node/node.d/apc_envunit_.in

  • Committer: Bazaar Package Importer
  • Author(s): Tore Anderson
  • Date: 2004-05-21 20:51:19 UTC
  • Revision ID: james.westby@ubuntu.com-20040521205119-oz8bllbjp9hs80ig
Tags: upstream-0+1.0.0pre5
ImportĀ upstreamĀ versionĀ 0+1.0.0pre5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
#
 
3
# Plugin to monitor APC environmental units (temperature/humidity)
 
4
#
 
5
# Usage: Copy or link into /etc/munin/node.d/
 
6
#
 
7
# Parameters:
 
8
#
 
9
#       config   (required)
 
10
#       autoconf (optional - used by munin-config)
 
11
#
 
12
# Config variables:
 
13
#
 
14
#       units     - DNS names of environmental units
 
15
#       oid       - OID Prefix for humidity probes
 
16
#       community - Community to use to access the APC unit
 
17
#
 
18
 
 
19
#
 
20
# Configuration for temperature or humidity probes 
 
21
#
 
22
 
 
23
type=`echo $0 | sed -e 's/.*_\(.*\)/\1/'`
 
24
if [ "${type}" = temperature ] ; then
 
25
  TOID="enterprises.318.1.1.10.3.13.1.1.3"
 
26
  NAME="temperature"
 
27
  LABEL="Celsius Degrees"
 
28
  LETTER="t"
 
29
else
 
30
  if [ "${type}" = humidity ] ; then
 
31
   TOID="enterprises.318.1.1.10.3.13.1.1.6"
 
32
   NAME="humidity"
 
33
   LABEL="Humidity %"
 
34
   LETTER="h"
 
35
  else 
 
36
    exit 1
 
37
  fi
 
38
fi
 
39
 
 
40
UNITS=""
 
41
COMMUNITY="public"
 
42
SNMPGET=`which snmpget`
 
43
 
 
44
if [ "$units" ]; then UNITS=$units ; fi
 
45
if [ "$oid" ]; then TOID=$oid ; fi
 
46
if [ "$community" ]; then COMMUNITY=$community ; fi
 
47
 
 
48
UNITS="rg20-sonde b105-sonde"
 
49
COMMUNITY="zorglub"
 
50
SNMPOPTS="-Ov -Oq -v1 -c ${COMMUNITY}"
 
51
 
 
52
if [ "$1" = "autoconf" ]; then
 
53
  if [ -z "${UNITS}" -o -z "${SNMPGET}" ] ; then echo "no" ; exit 1 ; fi
 
54
  for m in ${UNITS} ; do
 
55
    if ping -c1 -q $m  >/dev/null 2>&1 ; then continue ; fi
 
56
    echo "no" ; exit 1
 
57
  done
 
58
  echo "yes" ; exit 0
 
59
fi
 
60
 
 
61
if [ "$1" = "config" ]; then
 
62
  echo "graph_title Environmental units (${NAME} probes)"
 
63
  echo "graph_vlabel ${LABEL}"
 
64
  for m in ${UNITS} ; do
 
65
    mm=`echo ${m} | tr '-' '_'`
 
66
    echo "${mm}_${LETTER}1.label $m ${NAME} #1"
 
67
    echo "${mm}_${LETTER}2.label $m ${NAME} #2"
 
68
  done
 
69
  exit 0
 
70
fi
 
71
 
 
72
for m in ${UNITS} ; do
 
73
  v1=`${SNMPGET} ${SNMPOPTS} $m ${TOID}.1`
 
74
  v2=`${SNMPGET} ${SNMPOPTS} $m ${TOID}.2`
 
75
  mm=`echo ${m} | tr '-' '_'`
 
76
  echo "${mm}_${LETTER}1.value $v1"
 
77
  echo "${mm}_${LETTER}2.value $v2"
 
78
done