]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/munin/files/default/plugins/snmp__apcpdu_voltage
Improve PDU monitoring
[chef.git] / cookbooks / munin / files / default / plugins / snmp__apcpdu_voltage
diff --git a/cookbooks/munin/files/default/plugins/snmp__apcpdu_voltage b/cookbooks/munin/files/default/plugins/snmp__apcpdu_voltage
new file mode 100755 (executable)
index 0000000..70ec475
--- /dev/null
@@ -0,0 +1,34 @@
+#!/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 Voltage\n";
+    print "graph_args --base 1000 -l 0\n";
+    print "graph_vlabel Volts\n";
+    print "graph_category power\n";
+    print "graph_info This graph shows the voltage being supplied by the PDU.\n";
+
+    print "voltage.label Voltage\n";
+    print "voltage.type GUAGE\n";
+    print "voltage.info Current voltage.\n";
+    print "voltage.draw LINE2\n";
+} else {
+    my $voltage = $session->get_single(".1.3.6.1.4.1.318.1.1.26.6.3.1.6.1");
+
+    print "voltage.value ${voltage}\n";
+}