]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/munin/files/default/plugins/snmp__apcpdu_temperature
Add PDU environmental sensors to munin
[chef.git] / cookbooks / munin / files / default / plugins / snmp__apcpdu_temperature
diff --git a/cookbooks/munin/files/default/plugins/snmp__apcpdu_temperature b/cookbooks/munin/files/default/plugins/snmp__apcpdu_temperature
new file mode 100755 (executable)
index 0000000..309f473
--- /dev/null
@@ -0,0 +1,40 @@
+#!/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;
+    my $warning = $session->get_single(".1.3.6.1.4.1.318.1.1.26.10.2.1.1.11.1");
+    my $critical = $session->get_single(".1.3.6.1.4.1.318.1.1.26.10.2.1.1.10.1");
+
+    print "host_name $host\n" unless $host eq "localhost";
+    print "graph_title Temperature\n";
+    print "graph_args -l 0\n";
+    print "graph_vlabel Degrees Celsius\n";
+    print "graph_category sensors\n";
+    print "graph_info This graph shows the temperature from the PDUs environmental sensor.\n";
+
+    print "temperature.label Temperature\n";
+    print "temperature.type GAUGE\n";
+    print "temperature.info Temperature in degrees celsius.\n";
+    print "temperature.draw LINE2\n";
+    print "temperature.warning :${warning}\n";
+    print "temperature.critical :${critical}\n";
+} else {
+    my $temperature = $session->get_single(".1.3.6.1.4.1.318.1.1.26.10.2.2.1.8.1");
+
+    $temperature = $temperature / 10 unless $temperature eq "U";
+    
+    print "temperature.value ${temperature}\n";
+}