X-Git-Url: https://git.openstreetmap.org/chef.git/blobdiff_plain/fa1b1034b4b17ade3d585dec6ded0275387d3836..91946d5d67dc302bb147f0640cb5614416945891:/cookbooks/munin/files/default/plugins/snmp__apcpdu_power diff --git a/cookbooks/munin/files/default/plugins/snmp__apcpdu_power b/cookbooks/munin/files/default/plugins/snmp__apcpdu_power new file mode 100755 index 000000000..e873bf03a --- /dev/null +++ b/cookbooks/munin/files/default/plugins/snmp__apcpdu_power @@ -0,0 +1,36 @@ +#!/usr/bin/perl + +=head1 MAGIC MARKERS + + #%# family=snmpauto + #%# capabilities=snmpconf + +=cut + +use strict; +use warnings; +use Munin::Plugin::SNMP; + +my $session = Munin::Plugin::SNMP->session; + +if (defined $ARGV[0] and $ARGV[0] eq "config") { + my $host = $session->hostname; + + print "host_name $host\n" unless $host eq "localhost"; + print "graph_title Power\n"; + print "graph_args --base 1000 -l 0\n"; + print "graph_vlabel Watts\n"; + print "graph_category power\n"; + print "graph_info This graph shows the power being supplied by the PDU.\n"; + + print "power.label Power\n"; + print "power.type GUAGE\n"; + print "power.info Current power draw in watts.\n"; + print "power.draw LINE2\n"; +} else { + my $power = $session->get_single(".1.3.6.1.4.1.318.1.1.26.6.3.1.7.1"); + + $power = $power * 10 unless $power eq "U"; + + print "power.value ${power}\n"; +}