+++ /dev/null
-#!/usr/bin/perl
-#
-# Copyright (c) 2009 - Rune Nordbøe Skillingstad
-# Copyright (c) 2009 - Kai Ove Gran
-#
-# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-
-# snmp_host_apcpdu - For APC PDUs. Graphs total current throughput.
-#
-#%# family=snmpauto
-#%# capabilities=snmpconf
-
-use strict;
-use Net::SNMP;
-
-my $DEBUG = $ENV{DEBUG} || 0;
-my $host = $ENV{host} || undef;
-my $port = $ENV{port} || 161;
-my $community = $ENV{community} || "public";
-my $iface = $ENV{interface} || undef;
-my $timeout = $ENV{timeout} || 1;
-my $snmp_ver = $ENV{version} || 1;
-
-if($0 =~ /^(?:|.*\/)apcpdu_([^_]+)$/) {
- $host = $1;
- if($host =~ /^([^:]+):(\d+)$/) {
- $host = $1;
- $port = $2;
- }
-} elsif(!defined($host)) {
- die "# Error: couldn't understand what I'm supposed to monitor.";
-}
-
-my @oidsList = (
- '1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.1',
- '1.3.6.1.4.1.318.1.1.12.2.2.1.1.3.1',
- '1.3.6.1.4.1.318.1.1.12.1.7.0'
-);
-
-if(defined $ARGV[0] and $ARGV[0] eq "snmpconf") {
- for(my $i = 0; $i < @oidsList; $i++) {
- print "require " . $oidsList[$i] . "[0-9]\n";
- }
- exit 0;
-}
-
-my ($session, $error) = Net::SNMP->session(
- -hostname => $host,
- -community => $community,
- -port => $port,
- -timeout => $timeout,
- -version => $snmp_ver,
-);
-
-if(!defined ($session)) {
- die "# Croaking: $error";
-}
-
-if($ARGV[0] and $ARGV[0] eq "config") {
- my $name = &get_single($session, '1.3.6.1.4.1.318.1.1.4.3.3.0');
- if($name) {
-# print "host_name $host\n" unless $host eq 'localhost';
- print "graph_title Current for $name\n";
- print "graph_args --base 1000 -l 0\n";
- print "graph_vlabel Amps\n";
- print "graph_category Ups\n";
- print "graph_info This graph shows the total throughput of the PDU\n";
- print "graph_order load threshold rating\n";
- print "load.label Load\n";
- print "load.type GAUGE\n";
- print "load.info Current load in amps.\n";
- print "load.draw LINE2\n";
- print "threshold.label Threshold\n";
- print "threshold.type GAUGE\n";
- print "threshold.info Near overload threshold.\n";
- print "threshold.draw LINE2\n";
- print "rating.label Rating\n";
- print "rating.type GAUGE\n";
- print "rating.info Rating (Max amps).\n";
- print "rating.draw LINE2\n";
- }
- exit 0;
-}
-
-my @response = &get_multiple($session, @oidsList);
-
-printf "load.value %.02f\n", $response[0] / 10;
-printf "threshold.value %d\n", $response[1];
-printf "rating.value %d\n", $response[2];
-
-
-sub get_multiple {
- my $handle = shift;
- my @oids = @_;
-
- my @result;
- foreach my $oid (@oids) {
- push(@result, &get_single($handle,$oid));
- }
- chomp @result;
- return @result;
-}
-
-sub get_single {
- my ($handle, $oid) = @_;
-
- my $response = $handle->get_request ($oid);
- if(!defined $response->{$oid}) {
- print "# No response\n" if $DEBUG;
- return "";
- } else {
- print "# Got response \"".$response->{$oid}."\"\n" if $DEBUG;
- return $response->{$oid};
- }
-}
--- /dev/null
+#!/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.6.1.1.6.1");
+ my $critical = $session->get_single(".1.3.6.1.4.1.318.1.1.26.6.1.1.7.1");
+
+ print "host_name $host\n" unless $host eq "localhost";
+ print "graph_title Load\n";
+ print "graph_args --base 1000 -l 0\n";
+ print "graph_vlabel Amps\n";
+ print "graph_category power\n";
+ print "graph_info This graph shows the total throughput the PDU.\n";
+
+ print "current.label Current\n";
+ print "current.type GUAGE\n";
+ print "current.info Current load in amps.\n";
+ print "current.draw LINE2\n";
+ print "current.warning ${warning}\n";
+ print "current.critical ${critical}\n";
+} else {
+ my $current = $session->get_single(".1.3.6.1.4.1.318.1.1.26.6.3.1.5.1");
+
+ $current = $current / 10 unless $current eq "U";
+
+ print "current.value ${current}\n";
+}
--- /dev/null
+#!/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";
+}
--- /dev/null
+#!/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";
+}
<% end -%>
<% end -%>
<% end -%>
+
+# Configure monitoring for pdu1.ams.openstreetmap.org
+[pdu1.ams.openstreetmap]
+ address 10.0.48.10
+ use_node_name no
+
+# Configure monitoring for pdu1.ams.openstreetmap.org
+[pdu2.ams.openstreetmap]
+ address 10.0.48.10
+ use_node_name no
+
+# Configure compound graphs for ams.openstreetmap.org
+[ams.openstreetmap]
+ update no
+ apcpdu_current.graph_title Load
+ apcpdu_current.graph_args --lower-limit 0
+ apcpdu_current.graph_vlabel Amps
+ apcpdu_current.graph_category power
+ apcpdu_current.current.sum pdu1.ams.openstreetmap:snmp_pdu1.ams.openstreetmap.org_apcpdu_current.current pdu2.ams.openstreetmap:snmp_pdu2.ams.openstreetmap.org_apcpdu_current.current
+ apcpdu_current.current.label Current
+ apcpdu_current.current.min 0
+ apcpdu_power.graph_title Load
+ apcpdu_power.graph_args --base 1000 --lower-limit 0
+ apcpdu_power.graph_vlabel Watts
+ apcpdu_power.graph_category power
+ apcpdu_power.power.sum pdu1.ams.openstreetmap:snmp_pdu1.ams.openstreetmap.org_apcpdu_power.power pdu2.ams.openstreetmap:snmp_pdu2.ams.openstreetmap.org_apcpdu_power.power
+ apcpdu_power.power.label Power
+ apcpdu_power.power.min 0
<% unless @frontends.empty? && @backends.empty? -%>
# Configure compound graphs for www.openstreetmap.org
:data => "/store/elasticsearch"
}
},
- :munin => {
- :graphs => {
- :apcpdu_ams => {
- :title => "Current for Amsterdam",
- :vlabel => "Amps",
- :category => "Ups",
- :values => {
- :load => {
- :sum => ["apcpdu_pdu1.load", "apcpdu_pdu2.load"],
- :label => "Load"
- }
- }
- }
- }
- },
:networking => {
:interfaces => {
:internal_ipv4 => {