[Pkg-nagios-changes] [pkg-nagios-plugins-contrib] 12/32: import check_ipmi_sensor_v3-3.11

Jan Wagner waja at moszumanska.debian.org
Fri Nov 18 17:23:02 UTC 2016


This is an automated email from the git hooks/post-receive script.

waja pushed a commit to branch master
in repository pkg-nagios-plugins-contrib.

commit e36e4554e8f036468f3acf10c4368d91479d7bdf
Author: Evgeni Golov <evgeni at golov.de>
Date:   Sat Sep 24 14:01:31 2016 +0200

    import check_ipmi_sensor_v3-3.11
---
 check_ipmi_sensor/{gpl.txt => COPYING} |  0
 check_ipmi_sensor/changelog.txt        | 10 +++++
 check_ipmi_sensor/check_ipmi_sensor    | 73 +++++++++++++++++++++++-----------
 check_ipmi_sensor/control              |  2 +-
 4 files changed, 60 insertions(+), 25 deletions(-)

diff --git a/check_ipmi_sensor/gpl.txt b/check_ipmi_sensor/COPYING
similarity index 100%
rename from check_ipmi_sensor/gpl.txt
rename to check_ipmi_sensor/COPYING
diff --git a/check_ipmi_sensor/changelog.txt b/check_ipmi_sensor/changelog.txt
index 5298c2d..f9598f1 100644
--- a/check_ipmi_sensor/changelog.txt
+++ b/check_ipmi_sensor/changelog.txt
@@ -2,6 +2,16 @@
 Changelog for check_ipmi_sensor, a Nagios/Icinga plugin to check IPMI sensors
 ################################################################################
 
+Version 3.11 20160524
+  * Skip entities which are absent if '--noentityabsent' is present
+  * Per default monitor all SEL sensor types 
+    Add command line flag to specify entry types for SEL
+
+Version 3.10 20151020
+  * Only monitor specific sensor types from the system event log (SEL).
+    The check with ipmi-sel is limited to types of Memory and Processor for
+    monitoring.
+
 Version 3.9 20150624
   * Add exclude files for sensors - use name and type in a file to exclude not
     needed sensors (-xx for normal sensors, -sx for SEL entries).
diff --git a/check_ipmi_sensor/check_ipmi_sensor b/check_ipmi_sensor/check_ipmi_sensor
index 3a94c5f..37baea6 100755
--- a/check_ipmi_sensor/check_ipmi_sensor
+++ b/check_ipmi_sensor/check_ipmi_sensor
@@ -35,18 +35,17 @@ use Getopt::Long qw(:config no_ignore_case);
 use IPC::Run qw( run ); #interact with processes
 ################################################################################
 # set text variables
-our $check_ipmi_sensor_version = "3.9";
+our $check_ipmi_sensor_version = "3.11";
 
-sub get_version
-{
+sub get_version{
 	return <<EOT;
 check_ipmi_sensor version $check_ipmi_sensor_version
 Copyright (C) 2009-2015 Thomas-Krenn.AG
-Current updates at http://git.thomas-krenn.com/check_ipmi_sensor_v3.git
+Current updates at https://github.com/thomas-krenn/check_ipmi_sensor_v3.git
 EOT
 }
-sub get_usage
-{
+
+sub get_usage{
 	return <<EOT;
 Usage:
 check_ipmi_sensor -H <hostname>
@@ -57,8 +56,8 @@ check_ipmi_sensor -H <hostname>
   [-v|-vv|-vvv]
 EOT
 }
-sub get_help
-{
+
+sub get_help{
 	return <<EOT;
   [-H <hostname>]
        hostname or IP of the IPMI interface.
@@ -98,6 +97,11 @@ sub get_help
        '42.2 Sensor Type Codes and Data' of the IPMI 2.0 spec for a full list
        of possible sensor types. The available types depend on your particular
        server and the available sensors there.
+  [-ST <SEL entry type>]
+       limit SEL entries to specific types, run 'ipmi-sel -L' for a list of
+       types. All sensors are populated to the SEL and per default all sensor
+       types are monitored. E.g. to limit the sensor SEL types to Memory and
+       Processsor use -ST 'Memory,Processor'.
   [-x <sensor id>]
        exclude sensor matching <sensor id>. Useful for cases when unused
        sensors cannot be deleted from SDR and are reported in a non-OK state.
@@ -150,6 +154,8 @@ sub get_help
        turn off sudo usage on localhost or if ipmi host is ommited.
   [--nothresholds]
        turn off performance data thresholds from output-sensor-thresholds.
+  [--noentityabsent]
+       skip sensor checks for sensors that have 'noentityabsent' as event state
   [-s <ipmi-sensor output file>]
        simulation mode - test the plugin with an ipmi-sensor output redirected
        to a file.
@@ -159,11 +165,11 @@ sub get_help
        show version information
 
 Examples:
-  \$ check_ipmi_sensor -H 192.0.2.1 -U monitor -P monitor -L user 
+  \$ check_ipmi_sensor -H 192.0.2.1 -U monitor -P monitor -L user
     IPMI Status: OK | 'System Temp'=30.00 'Peripheral Temp'=32.00
     'FAN 1'=2775.00 [...]
   \$ check_ipmi_sensor -H 192.0.2.1 -U monitor -P monitor -L user -x 205
-    IPMI Status: OK | 'System Temp'=30.00 'Peripheral Temp'=32.00 
+    IPMI Status: OK | 'System Temp'=30.00 'Peripheral Temp'=32.00
     'FAN 2'=2775.00 [...]
   \$ check_ipmi_sensor -H 192.0.2.1 -U monitor -P monitor -L user -i 4,71
     IPMI Status: OK | 'System Temp'=30.00 'Peripheral Temp'=32.00
@@ -173,13 +179,16 @@ Examples:
 Further information about this plugin can be found at
 http://www.thomas-krenn.com/en/wiki/IPMI_Sensor_Monitoring_Plugin
 
+Use the github repo at https://github.com/thomas-krenn/check_ipmi_sensor_v3.git
+to submit patches, or suggest improvements.
+
 Send email to the IPMI-plugin-user mailing list if you have questions regarding
-use of this software, to submit patches, or suggest improvements.
-The mailing list is available at http://lists.thomas-krenn.com/
+use of this software. The mailing list is available at
+http://lists.thomas-krenn.com/
 EOT
 }
-sub usage
-{
+
+sub usage{
 	my ($arg) = @_; #the list of inputs
 	my ($exitcode);
 	if ( defined $arg ){
@@ -252,7 +261,7 @@ sub get_fru{
 		$frucmd[1] = $fru;
 	}
 	else{
-		$frucmd[0] = $fru;	
+		$frucmd[0] = $fru;
 	}
 	#skip checksum validation
 	push @frucmd,'-s';
@@ -282,6 +291,7 @@ sub get_fru{
 sub get_sel{
 	my @selcmd = @{(shift)};
 	my $verbosity = shift;
+	my @sel_sensor_types = @{(shift)};
 	my $sel;
 	if(-e '/usr/sbin/ipmi-sel'){
 		$sel = '/usr/sbin/ipmi-sel';
@@ -297,6 +307,7 @@ sub get_sel{
 		$selcmd[0] = $sel;
 	}
 	push @selcmd, '--output-event-state', '--interpret-oem-data', '--entity-sensor-names';
+	push @selcmd, '--sensor-types=' . join(',', @sel_sensor_types);
 	my $seloutput;
 	my $returncode;
 	run \@selcmd, '>&', \$seloutput;
@@ -322,10 +333,11 @@ sub parse_sel{
 	my $selcmd = shift;
 	my $verbosity = shift;
 	my $sel_xfile = shift;
-	my @seloutput = get_sel($selcmd, $verbosity);
+	my $sel_sensor_types = shift;
+	my @seloutput = get_sel($selcmd, $verbosity, $sel_sensor_types);
 	@seloutput = map { [ map { s/^\s*//; s/\s*$//; $_; } split(m/\|/, $_) ] } @seloutput;
 	my $header = shift(@seloutput);
-	
+
 	my @sel_rows;
 	foreach my $row (@seloutput){
 		my %curr_row;
@@ -358,7 +370,7 @@ sub exclude_with_file{
 	}
 	foreach my $exclude (@xlist){
 		my @curr_exclude = map { s/^\s*//; s/\s*$//; $_; } split(/\|/,$exclude);
-		if($curr_exclude[0] eq $name && 
+		if($curr_exclude[0] eq $name &&
 		$curr_exclude[1] eq $type){
 			$skip = 1;
 		}
@@ -406,8 +418,9 @@ MAIN: {
 	my $lanVersion;#if desired use a different protocol version
 	my $abort_text = '';
 	my $zenoss = 0;
+	my @sel_sensor_types;
 	my $simulate = '';
-	my ($use_fru, $no_sel, $no_sudo, $use_thresholds, $no_thresholds, $sel_xfile, $s_xfile);
+	my ($use_fru, $no_sel, $no_sudo, $use_thresholds, $no_thresholds, $sel_xfile, $s_xfile, $no_entity_absent);
 
 	#read in command line arguments and init hash variables with the given values from argv
 	if ( !( GetOptions(
@@ -419,10 +432,12 @@ MAIN: {
 		'O|options=s'		=> \@freeipmi_options,
 		'b|compat'			=> \$freeipmi_compat,
 		'T|sensor-types=s'	=> \@ipmi_sensor_types,
+		'ST|sel-sensor-types=s'	=> \@sel_sensor_types,
 		'fru'				=> \$use_fru,
 		'nosel'				=> \$no_sel,
 		'nosudo'			=> \$no_sudo,
 		'nothresholds'			=> \$no_thresholds,
+		'noentityabsent'	=> \$no_entity_absent,
 		'v|verbosity'		=> \$verbosity,
 		'vv'				=> sub{$verbosity=2},
 		'vvv'				=> sub{$verbosity=3},
@@ -490,6 +505,7 @@ MAIN: {
 	#also cf. http://perldoc.perl.org/Getopt/Long.html#Options-with-multiple-values
 	@freeipmi_options = split(/\s+/, join(' ', @freeipmi_options)); # a bit hack, shell word splitting should be implemented...
 	@ipmi_sensor_types = split(/,/, join(',', @ipmi_sensor_types));
+	@sel_sensor_types = split(/,/, join(',', @sel_sensor_types));
 	@ipmi_xlist = split(/,/, join(',', @ipmi_xlist));
 	@ipmi_ilist = split(/,/, join(',', @ipmi_ilist));
 
@@ -498,6 +514,11 @@ MAIN: {
 		$zenoss = 1;
 	}
 
+	# Per default monitor all sensor types, use -ST to specify your sensor types
+	if(!@sel_sensor_types){
+		@sel_sensor_types = ('all');
+	}
+
 	# Define basic ipmi command
 	my @basecmd = $IPMICOMMAND;
 	# If host is omitted localhost is assumed, if not turned off sudo is used
@@ -599,7 +620,7 @@ MAIN: {
 	}
 	my $seloutput;
 	if(!$no_sel){
-		$seloutput = parse_sel(\@selcmd, $verbosity, $sel_xfile);
+		$seloutput = parse_sel(\@selcmd, $verbosity, $sel_xfile, \@sel_sensor_types);
 	}
 ################################################################################
 # print debug output when verbosity is set to 3 (-vvv)
@@ -652,10 +673,10 @@ MAIN: {
 		}
 		#split at newlines, fetch array with lines of output
 		my @ipmioutput = split('\n', $ipmioutput);
-		
+
 		#remove sudo errors and warnings like they appear on dns resolving issues
 		@ipmioutput = map { /^sudo:/ ? () : $_ } @ipmioutput;
-		
+
 		#remove leading and trailing whitespace characters, split at the pipe delimiter
 		@ipmioutput = map { [ map { s/^\s*//; s/\s*$//; $_; } split(m/\|/, $_) ] } @ipmioutput;
 
@@ -707,8 +728,12 @@ MAIN: {
 			if( $zenoss ){
 				$row->{'name'} =~ s/ /_/g;
 			}
+			my $check_sensor_state = 1;
+			if($no_entity_absent && ($row->{'event'} eq '\'Entity Absent\'')){
+				$check_sensor_state = 0;
+			}
 			#check for warning sensors
-			if ( $row->{'state'} ne 'Nominal' && $row->{'state'} ne 'N/A' ){
+			if($check_sensor_state && ($row->{'state'} ne 'Nominal' && $row->{'state'} ne 'N/A')){
 				$exit = 1 if $exit < 1;
 				$exit = 2 if $exit < 2 && $row->{'state'} ne 'Warning';
 				#don't insert a , the first time
@@ -723,7 +748,7 @@ MAIN: {
 					}
 				}
 			}
-			if ( $row->{'units'} ne 'N/A' ){
+			if($check_sensor_state && ($row->{'units'} ne 'N/A')){
 				my $val = $row->{'reading'};
 				my $perf_data;
 				my $perf_thresholds;
diff --git a/check_ipmi_sensor/control b/check_ipmi_sensor/control
index a0654de..765213d 100644
--- a/check_ipmi_sensor/control
+++ b/check_ipmi_sensor/control
@@ -1,5 +1,5 @@
 Recommends: freeipmi-tools, libipc-run-perl
-Version: 3.9
+Version: 3.11
 Uploaders: Bernd Zeimetz <bzed at debian.org>
 Homepage: http://www.thomas-krenn.com/en/oss/ipmi-plugin.html
 Description: IPMI Sensor Monitoring Plugin

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-nagios/pkg-nagios-plugins-contrib.git



More information about the Pkg-nagios-changes mailing list