From: Tom Hughes Date: Fri, 3 Aug 2018 21:55:04 +0000 (+0100) Subject: Add PDU environmental sensors to munin X-Git-Url: https://git.openstreetmap.org/chef.git/commitdiff_plain/51c7169f70c83e5e857a2ee5560deda2c571c215?ds=sidebyside Add PDU environmental sensors to munin --- diff --git a/cookbooks/munin/files/default/plugins/snmp__apcpdu_humidity b/cookbooks/munin/files/default/plugins/snmp__apcpdu_humidity new file mode 100755 index 000000000..590068955 --- /dev/null +++ b/cookbooks/munin/files/default/plugins/snmp__apcpdu_humidity @@ -0,0 +1,38 @@ +#!/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.13.1"); + my $critical = $session->get_single(".1.3.6.1.4.1.318.1.1.26.10.2.1.1.14.1"); + + print "host_name $host\n" unless $host eq "localhost"; + print "graph_title Humidity\n"; + print "graph_args -l 0\n"; + print "graph_vlabel %\n"; + print "graph_category sensors\n"; + print "graph_info This graph shows the humidity from the PDUs environmental sensor.\n"; + + print "humidity.label Humidity\n"; + print "humidity.type GAUGE\n"; + print "humidity.info Relative humidity.\n"; + print "humidity.draw LINE2\n"; + print "humidity.warning ${warning}:\n"; + print "humidity.critical ${critical}:\n"; +} else { + my $humidity = $session->get_single(".1.3.6.1.4.1.318.1.1.26.10.2.2.1.10.1"); + + print "humidity.value ${humidity}\n"; +} diff --git a/cookbooks/munin/files/default/plugins/snmp__apcpdu_temperature b/cookbooks/munin/files/default/plugins/snmp__apcpdu_temperature new file mode 100755 index 000000000..309f47326 --- /dev/null +++ b/cookbooks/munin/files/default/plugins/snmp__apcpdu_temperature @@ -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"; +} diff --git a/cookbooks/munin/templates/default/munin.conf.erb b/cookbooks/munin/templates/default/munin.conf.erb index dd7d1f0fb..e8260717e 100644 --- a/cookbooks/munin/templates/default/munin.conf.erb +++ b/cookbooks/munin/templates/default/munin.conf.erb @@ -120,7 +120,23 @@ unknown_limit 144 apcpdu_power.graph_total total apcpdu_power.power.label Power apcpdu_power.power.draw AREASTACK - apcpdu_power.power.min 0 + apcpdu_power.power.min 0 + apcpdu_temperature.graph_title Temperature + apcpdu_temperature.graph_args --lower-limit 0 + apcpdu_temperature.graph_vlabel Degrees Celsius + apcpdu_temperature.graph_category sensors + apcpdu_temperature.graph_order pdu1=pdu1.ams.openstreetmap.org:snmp_pdu1_ams_openstreetmap_org_apcpdu_temperature.temperature + apcpdu_temperature.temperature.label Temperature + apcpdu_temperature.temperature.draw LINE2 + apcpdu_temperature.temperature.min 0 + apcpdu_humidity.graph_title Humidity + apcpdu_humidity.graph_args --lower-limit 0 + apcpdu_humidity.graph_vlabel % + apcpdu_humidity.graph_category sensors + apcpdu_humidity.graph_order pdu1=pdu1.ams.openstreetmap.org:snmp_pdu1_ams_openstreetmap_org_apcpdu_humidity.humidity + apcpdu_humidity.humidity.label Humidity + apcpdu_humidity.humidity.draw LINE2 + apcpdu_humidity.humidity.min 0 <% unless @frontends.empty? && @backends.empty? -%> # Configure compound graphs for www.openstreetmap.org @@ -200,7 +216,7 @@ unknown_limit 144 api_calls_error.http503.label 503 Service Unavailable api_calls_error.http503.warning :0.5 api_calls_error.http509.sum <%= Chef::Munin.expand "%%.openstreetmap.org:api_calls_status.http509", @frontends %> - api_calls_error.http509.label 509 Bandwidth Limit Exceeded + api_calls_error.http509.label 509 Bandwidth Limit Exceeded api_calls_error.http509.warning :5 api_calls_num.graph_title Requests processed api_calls_num.graph_vlabel Number of requests per ${graph_period}