contrib-munin/plugins/ups/apc_pdu_load

80 lines
1.7 KiB
Plaintext
Raw Normal View History

2011-01-31 10:31:06 +01:00
#!/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}'