[Pkg-nagios-changes] [pkg-nagios-plugins-contrib] 04/16: check_ipmi: Update to 3.12

Jan Wagner waja at moszumanska.debian.org
Mon Dec 5 09:45:23 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 a5b227606d8c52c3950d723613d0f045d9c642cf
Author: Jan Wagner <waja at cyconet.org>
Date:   Sun Dec 4 16:58:57 2016 +0100

    check_ipmi: Update to 3.12
---
 check_ipmi_sensor/README            |  4 +-
 check_ipmi_sensor/changelog.txt     |  8 ++++
 check_ipmi_sensor/check_ipmi_sensor | 81 +++++++++++++++++++++++++++++--------
 check_ipmi_sensor/control           |  2 +-
 4 files changed, 75 insertions(+), 20 deletions(-)

diff --git a/check_ipmi_sensor/README b/check_ipmi_sensor/README
index ead8a56..df57ea2 100644
--- a/check_ipmi_sensor/README
+++ b/check_ipmi_sensor/README
@@ -4,7 +4,7 @@
 
  check_ipmi_sensor: Nagios/Icinga plugin to check IPMI sensors
 
- Copyright (C) 2009-2015 Thomas-Krenn.AG,
+ Copyright (C) 2009-2016 Thomas-Krenn.AG,
  additional contributors see changelog.txt
 
  This program is free software; you can redistribute it and/or modify it under
@@ -42,4 +42,4 @@
  Notes on ipmi-sel:
  ------------------
    If you want to clear the ipmi system event log, pleas use:
-    o /usr/sbin/ipmi-sel -h $IP -u ADMIN -p $PW -l ADMIN --clear
\ No newline at end of file
+    o /usr/sbin/ipmi-sel -h $IP -u ADMIN -p $PW -l ADMIN --clear
diff --git a/check_ipmi_sensor/changelog.txt b/check_ipmi_sensor/changelog.txt
index f9598f1..257e3a7 100644
--- a/check_ipmi_sensor/changelog.txt
+++ b/check_ipmi_sensor/changelog.txt
@@ -2,6 +2,14 @@
 Changelog for check_ipmi_sensor, a Nagios/Icinga plugin to check IPMI sensors
 ################################################################################
 
+Version 3.12 20161005
+  * New Options added (closes issue #6)
+    Option -xT to exclude monitored sensor types
+    Option -xST to exclude SEL entries of specific sensor types
+  * Improved error message when a monitored server seems to be powered off
+  * More comprehensible output for warnings caused by SEL entries
+    (closes issue #7)
+
 Version 3.11 20160524
   * Skip entities which are absent if '--noentityabsent' is present
   * Per default monitor all SEL sensor types 
diff --git a/check_ipmi_sensor/check_ipmi_sensor b/check_ipmi_sensor/check_ipmi_sensor
index 37baea6..f6d598f 100755
--- a/check_ipmi_sensor/check_ipmi_sensor
+++ b/check_ipmi_sensor/check_ipmi_sensor
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 # check_ipmi_sensor: Nagios/Icinga plugin to check IPMI sensors
 #
-# Copyright (C) 2009-2015 Thomas-Krenn.AG,
+# Copyright (C) 2009-2016 Thomas-Krenn.AG,
 # additional contributors see changelog.txt
 #
 # This program is free software; you can redistribute it and/or modify it under
@@ -35,12 +35,12 @@ 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.11";
+our $check_ipmi_sensor_version = "3.12";
 
 sub get_version{
 	return <<EOT;
 check_ipmi_sensor version $check_ipmi_sensor_version
-Copyright (C) 2009-2015 Thomas-Krenn.AG
+Copyright (C) 2009-2016 Thomas-Krenn.AG
 Current updates at https://github.com/thomas-krenn/check_ipmi_sensor_v3.git
 EOT
 }
@@ -50,7 +50,8 @@ sub get_usage{
 Usage:
 check_ipmi_sensor -H <hostname>
   [-f <FreeIPMI config file> | -U <username> -P <password> -L <privilege level>]
-  [-O <FreeIPMI options>] [-b] [-T <sensor type>] [-x <sensor id>]
+  [-O <FreeIPMI options>] [-b] [-T <sensor type(s)>] [-x <sensor id>]
+  [-xT <sensor type(s)>] [-xST <SEL sensor type(s)]
   [-i <sensor id>] [-o zenoss] [-D <protocol LAN version>] [-h] [-V]
   [-fc <num_fans>] [--fru] [--nosel] [--nothresholds] [--nosudo]
   [-v|-vv|-vvv]
@@ -90,14 +91,15 @@ sub get_help{
   [-b]
        backward compatibility mode for FreeIPMI 0.5.* (this omits the FreeIPMI
        caching options --quiet-cache and --sdr-cache-recreate)
-  [-T <sensor type>]
+  [-T <sensor type(s)>]
        limit sensors to query based on IPMI sensor type.
        Examples for IPMI sensor types are 'Fan', 'Temperature', 'Voltage', ...
        See the output of the FreeIPMI command 'ipmi-sensors -L' and chapter
        '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>]
+       Multiple sensor types can be specified as a comma-separated list.
+  [-ST <SEL sensor type(s)>]
        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
@@ -108,6 +110,12 @@ sub get_help{
        Option can be specified multiple times. The <sensor id> is a numeric
        value (sensor names are not used as some servers have multiple sensors
        with the same name). Use -vvv option to query the <sensor ids>.
+  [-xT <sensor type(s)>]
+       exclude sensors based on IPMI sensor type.
+       Multiple sensor types can be specified as a comma-separated list.
+  [-xST <SEL sensor type(s)]
+       exclude SEL entries of specific sensor types.
+       Multiple sensor types can be specified as a comma-separated list.
   [-i <sensor id>]
        include only sensor matching <sensor id>. Useful for cases when only
        specific sensors should be monitored. Be aware that only for the
@@ -138,7 +146,8 @@ sub get_help{
          IPMI Status: OK (9000096781)
   [--nosel]
        turn off system event log checking via ipmi-sel. If there are
-       unintentional entries in SEL, use 'ipmi-sel --clear'.
+       unintentional entries in SEL, use 'ipmi-sel --clear' or the -sx or -xST
+       option.
   [-sx|--selexclude <sel exclude file>]
        use a sel exclude file to exclude entries from the system event log.
        Specify name and type pipe delimitered in this file to exclude an entry,
@@ -292,6 +301,7 @@ sub get_sel{
 	my @selcmd = @{(shift)};
 	my $verbosity = shift;
 	my @sel_sensor_types = @{(shift)};
+	my @exclude_sel_sensor_types = @{(shift)};
 	my $sel;
 	if(-e '/usr/sbin/ipmi-sel'){
 		$sel = '/usr/sbin/ipmi-sel';
@@ -308,6 +318,7 @@ sub get_sel{
 	}
 	push @selcmd, '--output-event-state', '--interpret-oem-data', '--entity-sensor-names';
 	push @selcmd, '--sensor-types=' . join(',', @sel_sensor_types);
+	push @selcmd, '--exclude-sensor-types=' . join(',', @exclude_sel_sensor_types);
 	my $seloutput;
 	my $returncode;
 	run \@selcmd, '>&', \$seloutput;
@@ -334,7 +345,8 @@ sub parse_sel{
 	my $verbosity = shift;
 	my $sel_xfile = shift;
 	my $sel_sensor_types = shift;
-	my @seloutput = get_sel($selcmd, $verbosity, $sel_sensor_types);
+	my $exclude_sel_sensor_types = shift;
+	my @seloutput = get_sel($selcmd, $verbosity, $sel_sensor_types, $exclude_sel_sensor_types);
 	@seloutput = map { [ map { s/^\s*//; s/\s*$//; $_; } split(m/\|/, $_) ] } @seloutput;
 	my $header = shift(@seloutput);
 
@@ -411,7 +423,7 @@ MAIN: {
 	my ($show_help, $show_version);
 	my ($ipmi_host, $ipmi_user, $ipmi_password, $ipmi_privilege_level, $ipmi_config_file, $ipmi_outformat);
 	my (@freeipmi_options, $freeipmi_compat);
-	my (@ipmi_sensor_types, @ipmi_xlist, @ipmi_ilist);
+	my (@ipmi_sensor_types, @ipmi_exclude_sensor_types, @ipmi_xlist, @ipmi_ilist);
 	my (@ipmi_version);
 	my $ipmi_sensors = 0;#states to use ipmi-sensors instead of ipmimonitoring
 	my $fan_count;#number of fans that should be installed in unit
@@ -419,6 +431,8 @@ MAIN: {
 	my $abort_text = '';
 	my $zenoss = 0;
 	my @sel_sensor_types;
+	my @exclude_sel_sensor_types;
+	my $sel_issues_present = 0;
 	my $simulate = '';
 	my ($use_fru, $no_sel, $no_sudo, $use_thresholds, $no_thresholds, $sel_xfile, $s_xfile, $no_entity_absent);
 
@@ -432,7 +446,9 @@ MAIN: {
 		'O|options=s'		=> \@freeipmi_options,
 		'b|compat'			=> \$freeipmi_compat,
 		'T|sensor-types=s'	=> \@ipmi_sensor_types,
+		'xT|exclude-sensor-types=s'	=> \@ipmi_exclude_sensor_types,
 		'ST|sel-sensor-types=s'	=> \@sel_sensor_types,
+		'xST|exclude-sel-sensor-types=s'	=> \@exclude_sel_sensor_types,
 		'fru'				=> \$use_fru,
 		'nosel'				=> \$no_sel,
 		'nosudo'			=> \$no_sudo,
@@ -505,7 +521,9 @@ 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));
+	@ipmi_exclude_sensor_types = split(/,/, join(',', @ipmi_exclude_sensor_types));
 	@sel_sensor_types = split(/,/, join(',', @sel_sensor_types));
+	@exclude_sel_sensor_types = split(/,/, join(',', @exclude_sel_sensor_types));
 	@ipmi_xlist = split(/,/, join(',', @ipmi_xlist));
 	@ipmi_ilist = split(/,/, join(',', @ipmi_ilist));
 
@@ -518,6 +536,10 @@ MAIN: {
 	if(!@sel_sensor_types){
 		@sel_sensor_types = ('all');
 	}
+    # If -xST has not been set, set this array to empty.
+	if(!@exclude_sel_sensor_types){
+		@exclude_sel_sensor_types = ('');
+	}
 
 	# Define basic ipmi command
 	my @basecmd = $IPMICOMMAND;
@@ -554,10 +576,19 @@ MAIN: {
 	}
 	my @selcmd = @basecmd;
 
-	# , is the seperator in the new string
 	if(@ipmi_sensor_types){
+		# , is the seperator in the new string
+    	# -g option is older name for ipmi-sensors -t or --sensor-types and
+    	# compatible with both older and newer version of FreeIPMI
 		push @basecmd, '-g', join(',', @ipmi_sensor_types);
 	}
+
+	# add sensor types to exclude
+	if(@ipmi_exclude_sensor_types){
+		push @basecmd, '--exclude-sensor-types', join(',', @ipmi_exclude_sensor_types);
+	}
+
+
 	if(@freeipmi_options){
 		push @basecmd, @freeipmi_options;
 	}
@@ -620,7 +651,7 @@ MAIN: {
 	}
 	my $seloutput;
 	if(!$no_sel){
-		$seloutput = parse_sel(\@selcmd, $verbosity, $sel_xfile, \@sel_sensor_types);
+		$seloutput = parse_sel(\@selcmd, $verbosity, $sel_xfile, \@sel_sensor_types, \@exclude_sel_sensor_types);
 	}
 ################################################################################
 # print debug output when verbosity is set to 3 (-vvv)
@@ -659,7 +690,8 @@ MAIN: {
 			@outputRows = split('\n', $ipmioutput);
 		}
 		if(!defined($ipmioutput) || scalar(@outputRows) == 1){
-			print "-> Execution of FreeIPMI returned an empty output or only 1 header row!\n";
+			print "-> Your server seems to be powered off.";
+			print " (Execution of FreeIPMI returned an empty output or only 1 header row!)\n";
 			print "-> $IPMICOMMAND was executed with the following parameters:\n";
 			print "   ", join(' ', @getstatus), "\n";
 			exit(3);
@@ -722,6 +754,7 @@ MAIN: {
 		#start with main output
 		my $exit = 0;
 		my $w_sensors = '';#sensors with warnings
+		my $sel_w_sensors = '';#verbose output for sel entries with warnings
 		my $perf = '';#performance sensor
 		my $curr_fans = 0;
 		foreach my $row ( @ipmioutput2 ){
@@ -797,17 +830,31 @@ MAIN: {
 				$row->{'name'} =~ s/ /_/g;
 			}
 			if ($row->{'state'} ne 'Nominal'){
+				$sel_issues_present += 1;
 				$exit = 1 if $exit < 1;
 				$exit = 2 if $exit < 2 && $row->{'state'} ne 'Warning';
-				$w_sensors .= ", " unless $w_sensors eq '';
-				$w_sensors .= "$row->{'name'} = $row->{'state'}";
 				if( $verbosity ){
-					if(defined($row->{'type'})){
-						$w_sensors .= " ($row->{'type'})" ;
-					}
+					$sel_w_sensors .= ", " unless $sel_w_sensors eq '';
+					$sel_w_sensors .= "($row->{'name'} = $row->{'state'},";
+					$sel_w_sensors .= " $row->{'type'}," ;
+					$sel_w_sensors .= " $row->{'event'})" ;
 				}
 			}
 		}
+		if ( $sel_issues_present ){
+			$w_sensors .= ", " unless $w_sensors eq '';
+			if ( $sel_issues_present == 1 ){
+				$w_sensors .= "1 system event log (SEL) entry present";
+			}else{
+				$w_sensors .= $sel_issues_present." system event log (SEL) entries present";
+			}
+			if( $verbosity ){
+				$w_sensors .= " - details: ";
+				$w_sensors .= $sel_w_sensors;
+				$w_sensors .= " - fix the reported issues and clear your SEL";
+				$w_sensors .= " or exclude specific SEL entries using the -sx or -xST option";
+			}
+		}
 		#now check if num fans equals desired unit fans
 		if( $fan_count ){
 			if( $curr_fans < $fan_count ){
diff --git a/check_ipmi_sensor/control b/check_ipmi_sensor/control
index 765213d..fd434f0 100644
--- a/check_ipmi_sensor/control
+++ b/check_ipmi_sensor/control
@@ -1,5 +1,5 @@
 Recommends: freeipmi-tools, libipc-run-perl
-Version: 3.11
+Version: 3.12
 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