-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapc_pdu_load
executable file
·79 lines (59 loc) · 1.72 KB
/
apc_pdu_load
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
#!/bin/sh
# -*- sh -*-
: << =cut
=head1 NAME
apc_pdu_load = plugin to show load in Ampere for an apc pdu
=head1 NOTES
This is a Munin plugin that shows the load in Ampere for an apc pdu
=head1 AUTHOR
Contributed by Alexander Swen
=head1 LICENSE
Copyright (c) 2011 Alexander Swen
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 dated June,
1991.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
=head1 CONFIGURATION
[apc_pdu_load]
env.pdu <host or ip of your pdu>
env.snmp_community public
env.snmp_version 1
env.load_oid .1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.1
=head1 MAGIC MARKERS
#%# family=auto
#%# capabilities=autoconf
=cut
snmp_version=${snmp_version:-1}
snmp_community=${snmp_community:-public}
load_oid=${load_iod:-.1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.1}
#. $MUNIN_LIBDIR/plugins/plugin.sh
if [ -z "${pdu}" ]; then
echo "pdu variable not set"
exit 1
fi
[ -n "$1" ] && case $1 in
autoconf)
echo yes
exit 0
;;
config)
cat << EOF
graph_title PDU load ${pdu}
graph_args -l 0
graph_scale yes
graph_vlabel Ampere
graph_category ups
load.label load
EOF
exit 0
;;
esac
/usr/bin/snmpget -v ${snmp_version} -c ${snmp_community} ${pdu} ${load_oid}|awk '{sub (/.*: /, "load.value ");print $1" "$2/10}'