[Pkg-nagios-changes] [pkg-nagios-plugins-contrib] 02/02: check_ipmi_sensor: Update to version 3.9

Jan Wagner waja at moszumanska.debian.org
Wed Jul 8 11:56:13 UTC 2015


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 af3e278d8e8234a7590b83df5320cba63622bfee
Author: Jan Wagner <waja at cyconet.org>
Date:   Wed Jul 8 12:58:42 2015 +0200

    check_ipmi_sensor: Update to version 3.9
---
 check_ipmi_sensor/README            | 10 ++++-
 check_ipmi_sensor/changelog.txt     |  4 ++
 check_ipmi_sensor/check_ipmi_sensor | 76 ++++++++++++++++++++++++++++++-------
 check_ipmi_sensor/control           |  2 +-
 4 files changed, 76 insertions(+), 16 deletions(-)

diff --git a/check_ipmi_sensor/README b/check_ipmi_sensor/README
index 2242066..ead8a56 100644
--- a/check_ipmi_sensor/README
+++ b/check_ipmi_sensor/README
@@ -32,8 +32,14 @@
  Installation hints:
  -------------------
    On Debian/Ubuntu use 'apt-get install libipc-run-perl' to install IPC::Run.
+   If you are running the plugin locally and not via network, the user 'nagios'
+   needs root privileges for calling:
+    o ipmimonitoring/ipmi-sensors/ipmi-sel/[ipmi-fru]
+   You can achieve that by adding a sudoers config (e.g. for ipmi-sensors)
+    o nagios ALL=(root) NOPASSWD: /usr/sbin/ipmi-sensors, /usr/sbin/ipmi-sel
+   Please check with '-vvv' which commands are run by the plugin!
 
  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
+   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
diff --git a/check_ipmi_sensor/changelog.txt b/check_ipmi_sensor/changelog.txt
index 875034f..5298c2d 100644
--- a/check_ipmi_sensor/changelog.txt
+++ b/check_ipmi_sensor/changelog.txt
@@ -2,6 +2,10 @@
 Changelog for check_ipmi_sensor, a Nagios/Icinga plugin to check IPMI sensors
 ################################################################################
 
+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).
+
 Version 3.8 20150402
   * If ipmi host is ommited, localhost is assumed without a LAN driver
   * Add a 'nosudo' option to disable sudo
diff --git a/check_ipmi_sensor/check_ipmi_sensor b/check_ipmi_sensor/check_ipmi_sensor
index 3bde7f9..3a94c5f 100755
--- a/check_ipmi_sensor/check_ipmi_sensor
+++ b/check_ipmi_sensor/check_ipmi_sensor
@@ -35,7 +35,7 @@ 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.8";
+our $check_ipmi_sensor_version = "3.9";
 
 sub get_version
 {
@@ -133,11 +133,26 @@ sub get_help
        For this purpose the tool 'ipmi-fru' is used. E.g.:
          IPMI Status: OK (9000096781)
   [--nosel]
-       turn off system event log checking via ipmi-sel.
+       turn off system event log checking via ipmi-sel. If there are
+       unintentional entries in SEL, use 'ipmi-sel --clear'.
+  [-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,
+       for example: System Chassis Chassis Intru|Physical Security
+       To get valid names and types use the -vvv option and take a look at:
+       debug output for sel (-vvv is set). Don't use name and type from the
+       web interface as sensor descriptions are not complete there.
+  [-xx|--sexclude <exclude file>]
+       use an exclude file to exclude sensors.
+       Specify name and type pipe delimitered in this file to exclude a sensor,
+       To get valid names and types use the -vvv option.
   [--nosudo]
        turn off sudo usage on localhost or if ipmi host is ommited.
   [--nothresholds]
        turn off performance data thresholds from output-sensor-thresholds.
+  [-s <ipmi-sensor output file>]
+       simulation mode - test the plugin with an ipmi-sensor output redirected
+       to a file.
   [-h]
        show this help
   [-V]
@@ -306,9 +321,11 @@ sub get_sel{
 sub parse_sel{
 	my $selcmd = shift;
 	my $verbosity = shift;
+	my $sel_xfile = shift;
 	my @seloutput = get_sel($selcmd, $verbosity);
 	@seloutput = map { [ map { s/^\s*//; s/\s*$//; $_; } split(m/\|/, $_) ] } @seloutput;
 	my $header = shift(@seloutput);
+	
 	my @sel_rows;
 	foreach my $row (@seloutput){
 		my %curr_row;
@@ -316,11 +333,40 @@ sub parse_sel{
 			my $key = lc $header->[$i];
 			$curr_row{$key} = $row->[$i];
 		}
-		push @sel_rows, \%curr_row;
+		if(!(exclude_with_file($sel_xfile, $curr_row{'name'}, $curr_row{'type'}))){
+			push @sel_rows, \%curr_row;
+		}
 	}
 	return \@sel_rows;
 }
 
+# Excludes a name and type pair if it is present in the given file, pipe
+# delimitered.
+# @return 1 if name should be skipped, 0 if not
+sub exclude_with_file{
+	my $file_name = shift;
+	my $name = shift;
+	my $type = shift;
+	my @xlist;
+	my $skip = 0;
+	if($file_name){
+		if(!(open (FH, "< $file_name"))){
+			print "-> Reading exclude file $file_name failed with: $!.\n";
+			exit(3);
+		};
+		@xlist = <FH>;
+	}
+	foreach my $exclude (@xlist){
+		my @curr_exclude = map { s/^\s*//; s/\s*$//; $_; } split(/\|/,$exclude);
+		if($curr_exclude[0] eq $name && 
+		$curr_exclude[1] eq $type){
+			$skip = 1;
+		}
+	}
+	close FH;
+	return $skip;
+}
+
 #define entire hashes
 our %hdrmap = (
 	'Record_ID'		=> 'id',	# FreeIPMI ...,0.7.x
@@ -337,12 +383,12 @@ our %hdrmap = (
 	'Sensor Reading'	=> 'reading',
 	'Reading'		=> 'reading',	# FreeIPMI 0.8.x
 	'Event'			=> 'event',	# FreeIPMI 0.8.x
-	'Lower C'			=> 'lowerC',
-	'Lower NC'			=> 'lowerNC',
-	'Upper C'			=> 'upperC',
-	'Upper NC'			=> 'upperNC',
-	'Lower NR'			=> 'lowerNR',
-	'Upper NR'			=> 'upperNR',
+	'Lower C'		=> 'lowerC',
+	'Lower NC'		=> 'lowerNC',
+	'Upper C'		=> 'upperC',
+	'Upper NC'		=> 'upperNC',
+	'Lower NR'		=> 'lowerNR',
+	'Upper NR'		=> 'upperNR',
 );
 
 our $verbosity = 0;
@@ -361,7 +407,7 @@ MAIN: {
 	my $abort_text = '';
 	my $zenoss = 0;
 	my $simulate = '';
-	my ($use_fru, $no_sel, $no_sudo, $use_thresholds, $no_thresholds);
+	my ($use_fru, $no_sel, $no_sudo, $use_thresholds, $no_thresholds, $sel_xfile, $s_xfile);
 
 	#read in command line arguments and init hash variables with the given values from argv
 	if ( !( GetOptions(
@@ -381,11 +427,13 @@ MAIN: {
 		'vv'				=> sub{$verbosity=2},
 		'vvv'				=> sub{$verbosity=3},
 		'x|exclude=s'		=> \@ipmi_xlist,
+		'sx|selexclude=s'	=> \$sel_xfile,
+		'xx|sexclude=s'		=> \$s_xfile,
 		'i|include=s'		=> \@ipmi_ilist,
 		'o|outformat=s'		=> \$ipmi_outformat,
 		'fc|fancount=i'		=> \$fan_count,
 		'D=s'				=> \$lanVersion,
-		's=s'				=>\$simulate,
+		's=s'				=> \$simulate,
 		'h|help'			=>
 			sub{print STDOUT get_version();
 				print STDOUT "\n";
@@ -551,7 +599,7 @@ MAIN: {
 	}
 	my $seloutput;
 	if(!$no_sel){
-		$seloutput = parse_sel(\@selcmd, $verbosity);
+		$seloutput = parse_sel(\@selcmd, $verbosity, $sel_xfile);
 	}
 ################################################################################
 # print debug output when verbosity is set to 3 (-vvv)
@@ -636,7 +684,9 @@ MAIN: {
 			while ( my ($key, $index) = each %header ){
 				$row{$key} = $row->[$index];
 			}
-			push @ipmioutput2, \%row;
+			if(!(exclude_with_file($s_xfile, $row{'name'}, $row{'type'}))){
+				push @ipmioutput2, \%row;
+			}
 		}
 		#create hash with sensor name an 1
 		my %ipmi_xlist = map { ($_, 1) } @ipmi_xlist;
diff --git a/check_ipmi_sensor/control b/check_ipmi_sensor/control
index 5df90aa..f097d96 100644
--- a/check_ipmi_sensor/control
+++ b/check_ipmi_sensor/control
@@ -1,5 +1,5 @@
 Recommends: freeipmi-tools, libipc-run-perl
-Version: 3.8
+Version: 3.9
 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