[Pkg-nagios-changes] [pkg-nagios-plugins-contrib] 12/24: check_raid: Update to 4.0.8
Jan Wagner
waja at moszumanska.debian.org
Wed Dec 13 22:07:35 UTC 2017
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 7fecaf3197369831e621bebaa2c000d29ccfa399
Author: Jan Wagner <waja at cyconet.org>
Date: Tue Nov 28 21:56:51 2017 +0100
check_raid: Update to 4.0.8
---
check_raid/check_raid | 85 +++++++++++++++++++++++++++++++++------------------
check_raid/control | 2 +-
2 files changed, 57 insertions(+), 30 deletions(-)
diff --git a/check_raid/check_raid b/check_raid/check_raid
index 33e724e..57c081a 100644
--- a/check_raid/check_raid
+++ b/check_raid/check_raid
@@ -74,6 +74,8 @@ $fatpacked{"App/Monitoring/Plugin/CheckRaid.pm"} = '#line '.(1+__LINE__).' "'.__
# Returns the plugin objects
sub active_plugins {
my $this = shift;
+ # whether the query is for sudo rules
+ my $sudo = shift || 0;
my @plugins = ();
@@ -83,7 +85,7 @@ $fatpacked{"App/Monitoring/Plugin/CheckRaid.pm"} = '#line '.(1+__LINE__).' "'.__
next unless $plugin->can('check');
# skip inactive plugins (disabled or no tools available)
- next unless $plugin->active;
+ next unless $plugin->active($sudo);
push(@plugins, $plugin);
}
@@ -2087,6 +2089,18 @@ $fatpacked{"App/Monitoring/Plugin/CheckRaid/Plugins/dm.pm"} = '#line '.(1+__LINE
qw(dmsetup);
}
+ sub active {
+ my ($this, $sudo) = @_;
+
+ # return if parent said NO
+ my $res = $this->SUPER::active(@_);
+ return $res unless $res;
+
+ # check if there really are any devices
+ my $c = $this->parse;
+ return !!@$c;
+ }
+
sub sudo {
my ($this, $deep) = @_;
# quick check when running check
@@ -2121,7 +2135,7 @@ $fatpacked{"App/Monitoring/Plugin/CheckRaid/Plugins/dm.pm"} = '#line '.(1+__LINE
sync_ratio
sync_action
mismatch_cnt
- );
+ );
my %h;
@h{@cols} = split;
@@ -2196,6 +2210,17 @@ $fatpacked{"App/Monitoring/Plugin/CheckRaid/Plugins/dm.pm"} = '#line '.(1+__LINE
sub parse {
my $this = shift;
+ # cache for single run
+ if (!defined($this->{parsed})) {
+ $this->{parsed} = $this->_parse;
+ }
+
+ return $this->{parsed};
+ }
+
+ sub _parse {
+ my $this = shift;
+
my @devices;
my $fh = $this->get_fh();
while (<$fh>) {
@@ -3660,8 +3685,7 @@ $fatpacked{"App/Monitoring/Plugin/CheckRaid/Plugins/mdstat.pm"} = '#line '.(1+__
} elsif (@fd > 0) {
# FIXME: this is same as above?
$this->warning;
- $s .= "hot-spare failure:". join(",", @{$md{failed_disks}}) .":$md{status}";
-
+ $s .= "hot-spare failure:". join(",", @fd) .":$md{status}";
} else {
$s .= "$md{status}";
}
@@ -5814,6 +5838,7 @@ $fatpacked{"App/Monitoring/Plugin/CheckRaid/Sudoers.pm"} = '#line '.(1+__LINE__)
#
# if sudoers config has "#includedir" directive, add file to that dir
# otherwise update main sudoers file
+ # @returns true if file was updated
sub sudoers {
my $dry_run = shift;
my @plugins = @_;
@@ -5830,7 +5855,7 @@ $fatpacked{"App/Monitoring/Plugin/CheckRaid/Sudoers.pm"} = '#line '.(1+__LINE__)
unless (@sudo) {
warn "Your configuration does not need to use sudo, sudoers not updated\n";
- return;
+ return 0;
}
my @rules = join "\n", (
@@ -5838,7 +5863,7 @@ $fatpacked{"App/Monitoring/Plugin/CheckRaid/Sudoers.pm"} = '#line '.(1+__LINE__)
# setup alias, so we could easily remove these later by matching lines with 'CHECK_RAID'
# also this avoids installing ourselves twice.
"# Lines matching CHECK_RAID added by $0 -S on ". scalar localtime,
- "User_Alias CHECK_RAID=nagios",
+ "User_Alias CHECK_RAID=nagios, icinga",
"Defaults:CHECK_RAID !requiretty",
# actual rules from plugins
@@ -5851,7 +5876,7 @@ $fatpacked{"App/Monitoring/Plugin/CheckRaid/Sudoers.pm"} = '#line '.(1+__LINE__)
warn "--- sudoers ---\n";
print @rules;
warn "--- sudoers ---\n";
- return;
+ return 0;
}
my $sudoers = find_file('/usr/local/etc/sudoers', '/etc/sudoers');
@@ -5901,10 +5926,12 @@ $fatpacked{"App/Monitoring/Plugin/CheckRaid/Sudoers.pm"} = '#line '.(1+__LINE__)
# use the new file
rename($new, $sudoers) or die $!;
warn "$sudoers file updated.\n";
- } else {
- warn "$sudoers file not changed.\n";
- unlink($new);
+ return 1;
}
+
+ warn "$sudoers file not changed.\n";
+ unlink($new);
+ return 0;
}
# return first "#includedir" directive from $sudoers file
@@ -6017,6 +6044,9 @@ $fatpacked{"App/Monitoring/Plugin/CheckRaid/Utils.pm"} = '#line '.(1+__LINE__).'
local $/ = undef;
local $_ = <$fh>;
close($fh) or die $!;
+ # prefer -n to skip password prompt
+ push(@sudo, '-n') if /-n/;
+ # ..if not supported, add -A as well
push(@sudo, '-A') if /-A/;
return \@sudo;
@@ -6129,7 +6159,7 @@ $fatpacked{"Module/Pluggable/Object.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."
MODULE_PLUGGABLE_OBJECT
$fatpacked{"Module/Runtime.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'MODULE_RUNTIME';
- package Module::Runtime;BEGIN {require 5.006}BEGIN {${^WARNING_BITS}=""}our$VERSION="0.014";our at EXPORT_OK=qw($module_name_rx is_module_name is_valid_module_name check_module_name module_notional_filename require_module use_module use_package_optimistically $top_module_spec_rx $sub_module_spec_rx is_module_spec is_valid_module_spec check_module_spec compose_module_name);my%export_ok=map {($_=>undef)}@EXPORT_OK;sub import {my$me=shift;my$callpkg=caller(0);my$errs="";for(@_){if(exists$exp [...]
+ package Module::Runtime;BEGIN {require 5.006}BEGIN {${^WARNING_BITS}=""}our$VERSION="0.015";our at EXPORT_OK=qw($module_name_rx is_module_name is_valid_module_name check_module_name module_notional_filename require_module use_module use_package_optimistically $top_module_spec_rx $sub_module_spec_rx is_module_spec is_valid_module_spec check_module_spec compose_module_name);my%export_ok=map {($_=>undef)}@EXPORT_OK;sub import {my$me=shift;my$callpkg=caller(0);my$errs="";for(@_){if(exists$exp [...]
sub Module::Runtime::__GUARD__::DESTROY {
delete $INC{$_[0]->[0]} if @{$_[0]};
}
@@ -6173,31 +6203,31 @@ $fatpacked{"Monitoring/Plugin/Threshold.pm"} = '#line '.(1+__LINE__).' "'.__FILE
MONITORING_PLUGIN_THRESHOLD
$fatpacked{"Params/Validate.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'PARAMS_VALIDATE';
- package Params::Validate;use 5.008001;use strict;use warnings;our$VERSION='1.26';use Exporter;use Module::Implementation;use Params::Validate::Constants;use vars qw($NO_VALIDATION %OPTIONS $options);our at ISA='Exporter';my at types=qw(SCALAR ARRAYREF HASHREF CODEREF GLOB GLOBREF SCALARREF HANDLE BOOLEAN UNDEF OBJECT);our%EXPORT_TAGS=('all'=>[qw(validate validate_pos validation_options validate_with), at types ],types=>\@types,);our at EXPORT_OK=(@{$EXPORT_TAGS{all}},'set_options');our at EXPORT=qw(v [...]
+ package Params::Validate;use 5.008001;use strict;use warnings;our$VERSION='1.29';use Exporter;use Module::Implementation;use Params::Validate::Constants;use vars qw($NO_VALIDATION %OPTIONS $options);our at ISA='Exporter';my at types=qw(SCALAR ARRAYREF HASHREF CODEREF GLOB GLOBREF SCALARREF HANDLE BOOLEAN UNDEF OBJECT);our%EXPORT_TAGS=('all'=>[qw(validate validate_pos validation_options validate_with), at types ],types=>\@types,);our at EXPORT_OK=(@{$EXPORT_TAGS{all}},'set_options');our at EXPORT=qw(v [...]
PARAMS_VALIDATE
$fatpacked{"Params/Validate/Constants.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'PARAMS_VALIDATE_CONSTANTS';
- package Params::Validate::Constants;use strict;use warnings;our$VERSION='1.26';our at ISA='Exporter';our at EXPORT=qw(SCALAR ARRAYREF HASHREF CODEREF GLOB GLOBREF SCALARREF HANDLE BOOLEAN UNDEF OBJECT UNKNOWN);sub SCALAR () {1}sub ARRAYREF () {2}sub HASHREF () {4}sub CODEREF () {8}sub GLOB () {16}sub GLOBREF () {32}sub SCALARREF () {64}sub UNKNOWN () {128}sub UNDEF () {256}sub OBJECT () {512}sub HANDLE () {16 | 32}sub BOOLEAN () {1 | 256}1;
+ package Params::Validate::Constants;use strict;use warnings;our$VERSION='1.29';our at ISA='Exporter';our at EXPORT=qw(SCALAR ARRAYREF HASHREF CODEREF GLOB GLOBREF SCALARREF HANDLE BOOLEAN UNDEF OBJECT UNKNOWN);sub SCALAR () {1}sub ARRAYREF () {2}sub HASHREF () {4}sub CODEREF () {8}sub GLOB () {16}sub GLOBREF () {32}sub SCALARREF () {64}sub UNKNOWN () {128}sub UNDEF () {256}sub OBJECT () {512}sub HANDLE () {16 | 32}sub BOOLEAN () {1 | 256}1;
PARAMS_VALIDATE_CONSTANTS
$fatpacked{"Params/Validate/PP.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'PARAMS_VALIDATE_PP';
- package Params::Validate::PP;use strict;use warnings;our$VERSION='1.26';use Params::Validate::Constants;use Scalar::Util 1.10 ();our$options;sub validate_pos (\@@) {return if$Params::Validate::NO_VALIDATION &&!defined wantarray;my$p=shift;my at specs=@_;my at p=@$p;if ($Params::Validate::NO_VALIDATION){for (my$x=$#p + 1;$x <= $#specs;$x++ ){$p[$x]=$specs[$x]->{default}if ref$specs[$x]&& exists$specs[$x]->{default}}return wantarray ? @p : \@p}local$options ||= _get_options((caller(0))[0])unle [...]
+ package Params::Validate::PP;use strict;use warnings;our$VERSION='1.29';use Params::Validate::Constants;use Scalar::Util 1.10 ();our$options;sub validate_pos (\@@) {return if$Params::Validate::NO_VALIDATION &&!defined wantarray;my$p=shift;my at specs=@_;my at p=@$p;if ($Params::Validate::NO_VALIDATION){for (my$x=$#p + 1;$x <= $#specs;$x++ ){$p[$x]=$specs[$x]->{default}if ref$specs[$x]&& exists$specs[$x]->{default}}return wantarray ? @p : \@p}local$options ||= _get_options((caller(0))[0])unle [...]
PARAMS_VALIDATE_PP
$fatpacked{"Params/Validate/XS.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'PARAMS_VALIDATE_XS';
- package Params::Validate::XS;use strict;use warnings;our$VERSION='1.26';use Carp;my$default_fail=sub {Carp::confess($_[0])};{my%defaults=(ignore_case=>0,strip_leading=>0,allow_extra=>0,on_fail=>$default_fail,stack_skip=>1,normalize_keys=>undef,);*set_options=\&validation_options;sub validation_options {my%opts=@_;my$caller=caller;for (keys%defaults){$opts{$_}=$defaults{$_}unless exists$opts{$_}}$Params::Validate::OPTIONS{$caller}=\%opts}use XSLoader;XSLoader::load(__PACKAGE__,exists$Pa [...]
+ package Params::Validate::XS;use strict;use warnings;our$VERSION='1.29';use Carp;my$default_fail=sub {Carp::confess($_[0])};{my%defaults=(ignore_case=>0,strip_leading=>0,allow_extra=>0,on_fail=>$default_fail,stack_skip=>1,normalize_keys=>undef,);*set_options=\&validation_options;sub validation_options {my%opts=@_;my$caller=caller;for (keys%defaults){$opts{$_}=$defaults{$_}unless exists$opts{$_}}$Params::Validate::OPTIONS{$caller}=\%opts}use XSLoader;XSLoader::load(__PACKAGE__,exists$Pa [...]
PARAMS_VALIDATE_XS
$fatpacked{"Params/ValidatePP.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'PARAMS_VALIDATEPP';
- package Params::Validate;our$VERSION='1.26';BEGIN {$ENV{PARAMS_VALIDATE_IMPLEMENTATION}='PP'}use Params::Validate;1;
+ package Params::Validate;our$VERSION='1.29';BEGIN {$ENV{PARAMS_VALIDATE_IMPLEMENTATION}='PP'}use Params::Validate;1;
PARAMS_VALIDATEPP
$fatpacked{"Params/ValidateXS.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'PARAMS_VALIDATEXS';
- package Params::Validate;our$VERSION='1.26';BEGIN {$ENV{PARAMS_VALIDATE_IMPLEMENTATION}='XS'}use Params::Validate;1;
+ package Params::Validate;our$VERSION='1.29';BEGIN {$ENV{PARAMS_VALIDATE_IMPLEMENTATION}='XS'}use Params::Validate;1;
PARAMS_VALIDATEXS
$fatpacked{"Try/Tiny.pm"} = '#line '.(1+__LINE__).' "'.__FILE__."\"\n".<<'TRY_TINY';
- package Try::Tiny;use 5.006;our$VERSION='0.27';use strict;use warnings;use Exporter 5.57 'import';our at EXPORT=our at EXPORT_OK=qw(try catch finally);use Carp;$Carp::Internal{+__PACKAGE__}++;BEGIN {my$su=$INC{'Sub/Util.pm'}&& defined&Sub::Util::set_subname;my$sn=$INC{'Sub/Name.pm'}&& eval {Sub::Name->VERSION(0.08)};unless ($su || $sn){$su=eval {require Sub::Util}&& defined&Sub::Util::set_subname;unless ($su){$sn=eval {require Sub::Name;Sub::Name->VERSION(0.08)}}}*_subname=$su ? \&Sub::Util: [...]
+ package Try::Tiny;use 5.006;our$VERSION='0.28';use strict;use warnings;use Exporter 5.57 'import';our at EXPORT=our at EXPORT_OK=qw(try catch finally);use Carp;$Carp::Internal{+__PACKAGE__}++;BEGIN {my$su=$INC{'Sub/Util.pm'}&& defined&Sub::Util::set_subname;my$sn=$INC{'Sub/Name.pm'}&& eval {Sub::Name->VERSION(0.08)};unless ($su || $sn){$su=eval {require Sub::Util}&& defined&Sub::Util::set_subname;unless ($su){$sn=eval {require Sub::Name;Sub::Name->VERSION(0.08)}}}*_subname=$su ? \&Sub::Util: [...]
TRY_TINY
s/^ //mg for values %fatpacked;
@@ -6252,7 +6282,7 @@ use warnings;
use strict;
my $PROGNAME = 'check_raid';
-my $VERSION = q/4.0.5/;
+my $VERSION = q/4.0.8/;
my $URL = 'https://github.com/glensc/nagios-plugin-check_raid';
my $BUGS_URL = 'https://github.com/glensc/nagios-plugin-check_raid#reporting-bugs';
@@ -6328,10 +6358,6 @@ $mp->add_arg(
spec => 'bbu-monitoring',
help => 'Enable experimental monitoring of the BBU status',
);
-$mp->add_arg(
- spec => 'warnonly|W',
- help => 'Treat CRITICAL errors as WARNING',
-);
$mp->getopts;
@@ -6387,7 +6413,13 @@ $App::Monitoring::Plugin::CheckRaid::Utils::debug = $mp->opts->debug;
if ($mp->opts->debug) {
print "$PROGNAME $VERSION\n";
- print "Visit <$BUGS_URL> how to report bugs\n\n",
+ print "Visit <$BUGS_URL> how to report bugs\n";
+ print "Please include output of **ALL** commands in bugreport\n\n";
+}
+
+if ($mp->opts->sudoers) {
+ my $res = sudoers($mp->opts->debug, $mc->active_plugins(1));
+ $mp->plugin_exit(OK, $res ? "sudoers updated" : "sudoers not updated");
}
my @plugins = $mc->active_plugins;
@@ -6395,11 +6427,6 @@ if (!@plugins) {
$mp->plugin_exit($plugin_options{options}{noraid_status}, "No active plugins (No RAID found)");
}
-if ($mp->opts->sudoers) {
- sudoers($mp->opts->debug, @plugins);
- $mp->plugin_exit(OK, "sudoers updated");
-}
-
# print active plugins
if ($mp->opts->list_plugins) {
foreach my $p (@plugins) {
diff --git a/check_raid/control b/check_raid/control
index 0b8fa5a..4e60205 100644
--- a/check_raid/control
+++ b/check_raid/control
@@ -1,7 +1,7 @@
Homepage: https://github.com/glensc/nagios-plugin-check_raid
Watch: https://github.com/glensc/nagios-plugin-check_raid "/glensc/nagios-plugin-check_raid/tree/([0-9.]+)"
Suggests: cciss-vol-status (>= 1.10), mpt-status
-Version: 4.0.5
+Version: 4.0.8
Uploaders: Bernd Zeimetz <bzed at debian.org>
Description: plugin to check sw/hw RAID status
The plugin looks for any known types of RAID configurations,
--
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