From 548a2b626eb6a794ccd194d943bcc956e14908c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Sun, 30 Dec 2012 09:23:18 -0800 Subject: [PATCH] freeipmi: implement suggestions from Bart ten Brinke for FreeIPMI 1.1.x. This adds support for versions of FreeIPMI before 1.2 (without the threshold information), and explicits the dependency information. It also works with older Munin nodes where dirtyconfig is not supported. --- plugins/sensors/freeipmi | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/plugins/sensors/freeipmi b/plugins/sensors/freeipmi index 0d34fb06..6016eb26 100755 --- a/plugins/sensors/freeipmi +++ b/plugins/sensors/freeipmi @@ -17,10 +17,29 @@ When used for the local host, the plugin should be linked as non-wildcard plugin, i.e., 'freeipmi', whereas when used to monitor a foreign host it should be, e.g., 'freeipmi_192.168.0.253'. +=head1 DEPENDENCIES + +The plugin requires FreeIPMI 1.1.5 or later to fetch the information. +Limits set on thresholds are available when using FreeIPMI 1.2.0 or +later. + =head1 AUTHOR Diego Elio Pettenò . +With help and suggestions of: + +Bart ten Brinke + +=head1 LICENSE + +GPLv2 + +=head1 MAGIC MARKERS + + #%# family=auto + #%# capabilities=autoconf + =head1 LICENSE GPLv2 @@ -42,12 +61,15 @@ my $IPMISENSORS = $ENV{'ipmisensors'} || 'ipmi-sensors'; $0 =~ /freeipmi(?:_(.+))$/; my $hostname = $1; -$IPMISENSORS .= " --quiet-cache --comma-separated-output --no-header-output --ignore-not-available-sensors --sensor-types=Temperature,Fan,Current,Voltage --output-sensor-thresholds"; +my $help_output = `$IPMISENSORS --help`; + +$IPMISENSORS .= " --output-sensor-thresholds" if $help_output =~ /--output-sensor-thresholds/; +$IPMISENSORS .= " --quiet-cache --comma-separated-output --no-header-output --ignore-not-available-sensors --sensor-types=Temperature,Fan,Current,Voltage"; $IPMISENSORS .= " --hostname=$hostname" if defined($hostname); $IPMISENSORS .= " --username=$ENV{IPMI_USERNAME}" if defined($ENV{IPMI_USERNAME}); $IPMISENSORS .= " --password=$ENV{IPMI_PASSWORD}" if defined($ENV{IPMI_PASSWORD}); -my $output=`$IPMISENSORS --output-sensor-thresholds 2>/dev/null`; +my $output=`$IPMISENSORS 2>/dev/null`; my $retval=$?; if ( defined $ARGV[0] and $ARGV[0] eq 'autoconf' ) { @@ -158,7 +180,7 @@ END } } - unless ( $ENV{MUNIN_CAP_DIRTYCONFIG} == 1 ) { + unless ( ($ENV{MUNIN_CAP_DIRTYCONFIG} || 0) == 1 ) { exit 0; } }