Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package monitoring-plugins-smart for openSUSE:Factory checked in at 2021-11-20 02:39:31 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/monitoring-plugins-smart (Old) and /work/SRC/openSUSE:Factory/.monitoring-plugins-smart.new.1895 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "monitoring-plugins-smart" Sat Nov 20 02:39:31 2021 rev:7 rq:932589 version:6.11.0 Changes: -------- --- /work/SRC/openSUSE:Factory/monitoring-plugins-smart/monitoring-plugins-smart.changes 2021-05-10 15:42:07.272912328 +0200 +++ /work/SRC/openSUSE:Factory/.monitoring-plugins-smart.new.1895/monitoring-plugins-smart.changes 2021-11-20 02:40:54.044431590 +0100 @@ -1,0 +2,14 @@ +Fri Nov 19 20:32:24 UTC 2021 - l...@linux-schulserver.de - 6.11.0 + +- reduce the sudoers rights for nagios user from using smartctl to + only call the plugin itself. As the plugin is called with sudo + rights, the included sudo calls in the plugin will also be executed + as root and don't cause any problem. As the plugin is only writable + by root, this forbits the nagios user to execute smartctl with + arbitrary options (boo#1191671) +- update to 6.11.0 + + Handle dots in NVMe attributes, prioritize (order) alerts + + Add aacraid devices (6.10.0) +- add rpmlintrc + +------------------------------------------------------------------- Old: ---- check_smart-6.9.1.tar.xz New: ---- check_smart-6.11.0.tar.xz monitoring-plugins-smart-rpmlintrc ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ monitoring-plugins-smart.spec ++++++ --- /var/tmp/diff_new_pack.5eWtym/_old 2021-11-20 02:40:54.636429637 +0100 +++ /var/tmp/diff_new_pack.5eWtym/_new 2021-11-20 02:40:54.640429624 +0100 @@ -17,7 +17,7 @@ Name: monitoring-plugins-smart -Version: 6.9.1 +Version: 6.11.0 Release: 0 Summary: Check SMART status of a given disk License: SUSE-Public-Domain @@ -26,6 +26,7 @@ Source0: check_smart-%{version}.tar.xz Source1: usr.lib.nagios.plugins.check_smart Source3: monitoring-plugins-smart-README.SUSE +Source4: monitoring-plugins-smart-rpmlintrc BuildRequires: nagios-rpm-macros BuildRequires: sudo Requires: monitoring-plugins-common @@ -65,8 +66,8 @@ %if 0%{?suse_version} > 1130 mkdir -p %{buildroot}/%{_sysconfdir}/sudoers.d cat >> %{buildroot}/%{_sysconfdir}/sudoers.d/%{name} << EOF -# the next line is needed for %%{name} to allow the correct use of smartctl -nagios ALL=(root) NOPASSWD: %{_sbindir}/smartctl +# the next line is needed for %{name} to allow the correct use of smartctl +nagios ALL=(root) NOPASSWD: %{nagios_plugindir}/check_smart EOF %endif ++++++ _service ++++++ --- /var/tmp/diff_new_pack.5eWtym/_old 2021-11-20 02:40:54.676429505 +0100 +++ /var/tmp/diff_new_pack.5eWtym/_new 2021-11-20 02:40:54.680429491 +0100 @@ -2,10 +2,10 @@ <service name="tar_scm" mode="localonly"> <param name="url">https://github.com/Napsty/check_smart.git</param> <param name="scm">git</param> - <param name="revision">6.9.1</param> + <param name="revision">6.11.0</param> <param name="exclude">.git</param> - <param name="versionformat">6.9.1</param> - <param name="revision">6.9.1</param> + <param name="versionformat">6.11.0</param> + <param name="revision">6.11.0</param> <param name="filename">check_smart</param> </service> <service name="set_version" mode="localonly"> ++++++ check_smart-6.9.1.tar.xz -> check_smart-6.11.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/check_smart-6.9.1/check_smart.pl new/check_smart-6.11.0/check_smart.pl --- old/check_smart-6.9.1/check_smart.pl 2021-04-08 09:59:56.000000000 +0200 +++ new/check_smart-6.11.0/check_smart.pl 2021-10-04 13:11:08.000000000 +0200 @@ -48,13 +48,15 @@ # Mar 3, 2021: Evan Felix - Allow use of colons in pathnames so /dev/disk/by-path/ device names work (6.9.0) # Mar 4, 2021: Claudio Kuenzler - Add SSD attribute Percent_Lifetime_Remain check (-l|--ssd-lifetime) (6.9.0) # Apr 8, 2021: Claudio Kuenzler - Fix regex for pseudo-devices (6.9.1) +# Jul 6, 2021: Bernhard Bittner - Add aacraid devices (6.10.0) +# Oct 4, 2021: Claudio Kuenzler + Peter Newman - Handle dots in NVMe attributes, prioritize (order) alerts (6.11.0) use strict; use Getopt::Long; use File::Basename qw(basename); my $basename = basename($0); -my $revision = '6.9.1'; +my $revision = '6.11.0'; # Standard Nagios return codes my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4); @@ -132,7 +134,7 @@ # Allow all device types currently supported by smartctl # See http://www.smartmontools.org/wiki/Supported_RAID-Controllers - if ($opt_i =~ m/(ata|scsi|3ware|areca|hpt|cciss|megaraid|sat|auto|nvme)/) { + if ($opt_i =~ m/(ata|scsi|3ware|areca|hpt|aacraid|cciss|megaraid|sat|auto|nvme)/) { $interface = $opt_i; if($interface =~ m/megaraid,\[(\d{1,2})-(\d{1,2})\]/) { $interface = ""; @@ -152,6 +154,12 @@ $interface .= "cciss," . $k . "|"; } } + elsif($interface =~ m/aacraid,\[(\d{1,2})-(\d{1,2})\]/) { + $interface = ""; + for(my $k = $1; $k <= $2; $k++) { + $interface .= "aacraid," . $k . "|"; + } + } else { $interface .= "|"; } @@ -214,11 +222,15 @@ my @drives_status_okay; my @drives_status_not_okay; +my @drives_status_warning; +my @drives_status_critical; my $drive_details; foreach $device ( split("\\|",$device) ){ foreach $interface ( split("\\|",$interface) ){ my @error_messages = qw//; + my @warning_messages = qw//; + my @notice_messages = qw//; my($status_string_local)=''; my($tag,$label); $exit_status_local = 'OK'; @@ -227,7 +239,7 @@ # we had a pattern based on $opt_g $tag = $device; $tag =~ s/\Q$opt_g\E//; - if($interface =~ qr/(?:megaraid|3ware|cciss)/){ + if($interface =~ qr/(?:megaraid|3ware|aacraid|cciss)/){ $label = "[$interface] - "; } else { $label = "[$device] - "; @@ -364,7 +376,7 @@ escalate_status('UNKNOWN'); } if ($return_code & 0x04) { - push(@error_messages, 'Checksum failure'); + push(@warning_messages, 'Checksum failure'); escalate_status('WARNING'); } if ($return_code & 0x08) { @@ -372,19 +384,19 @@ escalate_status('CRITICAL'); } if ($return_code & 0x10) { - push(@error_messages, 'Disk is in prefail'); + push(@warning_messages, 'Disk is in prefail'); escalate_status('WARNING'); } if ($return_code & 0x20) { - push(@error_messages, 'Disk may be close to failure'); + push(@warning_messages, 'Disk may be close to failure'); escalate_status('WARNING'); } if ($return_code & 0x40) { - push(@error_messages, 'Error log contains errors'); + push(@warning_messages, 'Error log contains errors'); escalate_status('WARNING'); } if ($return_code & 0x80) { - push(@error_messages, 'Self-test log contains errors'); + push(@warning_messages, 'Self-test log contains errors'); escalate_status('WARNING'); } if ($return_code && !$exit_status_local) { @@ -406,7 +418,7 @@ warn "(debug) exit code:\n$return_code\n\n" if $opt_debug; if ($return_code > 0) { - push(@error_messages, 'Self-test log contains errors'); + push(@warning_messages, 'Self-test log contains errors'); warn "(debug) Self-test log contains errors\n\n" if $opt_debug; escalate_status('WARNING'); } @@ -449,7 +461,7 @@ if (grep {$_ eq $attribute_number || $_ eq $attribute_name || $_ eq $when_failed} @exclude_checks) { warn "SMART Attribute $attribute_name failed at $when_failed but was set to be ignored\n" if $opt_debug; } else { - push(@error_messages, "Attribute $attribute_name failed at $when_failed"); + push(@warning_messages, "Attribute $attribute_name failed at $when_failed"); escalate_status('WARNING'); warn "(debug) parsed SMART attribute $attribute_name with error condition:\n$when_failed\n\n" if $opt_debug; } @@ -473,15 +485,15 @@ # Check for warning thresholds if ( ($warn_list{$attribute_name}) && ($raw_value >= $warn_list{$attribute_name}) ) { warn "(debug) $attribute_name is non-zero ($raw_value)\n\n" if $opt_debug; - push(@error_messages, "$attribute_name is non-zero ($raw_value)"); + push(@warning_messages, "$attribute_name is non-zero ($raw_value)"); escalate_status('WARNING'); } elsif ( ($warn_list{$attribute_name}) && ($raw_value < $warn_list{$attribute_name}) ) { warn "(debug) $attribute_name is non-zero ($raw_value) but less than $warn_list{$attribute_name}\n\n" if $opt_debug; - push(@error_messages, "$attribute_name is non-zero ($raw_value) (but less than threshold $warn_list{$attribute_name})"); + push(@notice_messages, "$attribute_name is non-zero ($raw_value) (but less than threshold $warn_list{$attribute_name})"); } else { warn "(debug) $attribute_name is non-zero ($raw_value)\n\n" if $opt_debug; - push(@error_messages, "$attribute_name is non-zero ($raw_value)"); + push(@warning_messages, "$attribute_name is non-zero ($raw_value)"); escalate_status('WARNING'); } } else { @@ -499,6 +511,7 @@ my ($attribute_name, $raw_value) = ($1, $2); $raw_value =~ s/\s|,//g; $attribute_name =~ s/\s/_/g; + $attribute_name =~ s/.//g; # some attributes produce irrelevant data; no need to graph them if (grep {$_ eq $attribute_name} ('Critical_Warning') ){ @@ -518,67 +531,67 @@ # Handle Critical_Warning values if ($attribute_name eq 'Critical_Warning') { if ($raw_value eq '0x01') { - push(@error_messages, "Available spare below threshold"); + push(@warning_messages, "Available spare below threshold"); escalate_status('WARNING'); } elsif ($raw_value eq '0x02') { - push(@error_messages, "Temperature is above or below thresholds"); + push(@warning_messages, "Temperature is above or below thresholds"); escalate_status('WARNING'); } elsif ($raw_value eq '0x03') { - push(@error_messages, "Available spare below threshold and temperature is above or below thresholds"); + push(@warning_messages, "Available spare below threshold and temperature is above or below thresholds"); escalate_status('WARNING'); } elsif ($raw_value eq '0x04') { - push(@error_messages, "NVM subsystem reliability degraded"); + push(@warning_messages, "NVM subsystem reliability degraded"); escalate_status('WARNING'); } elsif ($raw_value eq '0x05') { - push(@error_messages, "Available spare below threshold and NVM subsystem reliability degraded"); + push(@warning_messages, "Available spare below threshold and NVM subsystem reliability degraded"); escalate_status('WARNING'); } elsif ($raw_value eq '0x06') { - push(@error_messages, "Temperature is above or below thresholds and NVM subsystem reliability degraded"); + push(@warning_messages, "Temperature is above or below thresholds and NVM subsystem reliability degraded"); escalate_status('WARNING'); } elsif ($raw_value eq '0x07') { - push(@error_messages, "Available spare below threshold and Temperature is above or below thresholds and NVM subsystem reliability degraded"); + push(@warning_messages, "Available spare below threshold and Temperature is above or below thresholds and NVM subsystem reliability degraded"); escalate_status('WARNING'); } elsif ($raw_value eq '0x08') { - push(@error_messages, "Media in read only mode"); + push(@warning_messages, "Media in read only mode"); escalate_status('WARNING'); } elsif ($raw_value eq '0x09') { - push(@error_messages, "Media in read only mode and Available spare below threshold"); + push(@warning_messages, "Media in read only mode and Available spare below threshold"); escalate_status('WARNING'); } elsif ($raw_value eq '0x0A') { - push(@error_messages, "Media in read only mode and Temperature is above or below thresholds"); + push(@warning_messages, "Media in read only mode and Temperature is above or below thresholds"); escalate_status('WARNING'); } elsif ($raw_value eq '0x0B') { - push(@error_messages, "Media in read only mode and Temperature is above or below thresholds and Available spare below threshold"); + push(@warning_messages, "Media in read only mode and Temperature is above or below thresholds and Available spare below threshold"); escalate_status('WARNING'); } elsif ($raw_value eq '0x0C') { - push(@error_messages, "Media in read only mode and NVM subsystem reliability degraded"); + push(@warning_messages, "Media in read only mode and NVM subsystem reliability degraded"); escalate_status('WARNING'); } elsif ($raw_value eq '0x0D') { - push(@error_messages, "Media in read only mode and NVM subsystem reliability degraded and Available spare below threshold"); + push(@warning_messages, "Media in read only mode and NVM subsystem reliability degraded and Available spare below threshold"); escalate_status('WARNING'); } elsif ($raw_value eq '0x0E') { - push(@error_messages, "Media in read only mode and NVM subsystem reliability degraded and Temperature is above or below thresholds"); + push(@warning_messages, "Media in read only mode and NVM subsystem reliability degraded and Temperature is above or below thresholds"); escalate_status('WARNING'); } elsif ($raw_value eq '0x0F') { - push(@error_messages, "Media in read only mode and NVM subsystem reliability degraded and Temperature is above or below thresholds"); + push(@warning_messages, "Media in read only mode and NVM subsystem reliability degraded and Temperature is above or below thresholds"); escalate_status('WARNING'); } elsif ($raw_value eq '0x10') { - push(@error_messages, "Volatile memory backup device failed"); + push(@warning_messages, "Volatile memory backup device failed"); escalate_status('WARNING'); } } @@ -589,14 +602,14 @@ # Check for warning thresholds if ( ($warn_list{$attribute_name}) && ($raw_value >= $warn_list{$attribute_name}) ) { warn "(debug) $attribute_name is non-zero ($raw_value)\n\n" if $opt_debug; - push(@error_messages, "$attribute_name is non-zero ($raw_value)"); + push(@warning_messages, "$attribute_name is non-zero ($raw_value)"); escalate_status('WARNING'); } elsif ( ($warn_list{$attribute_name}) && ($raw_value < $warn_list{$attribute_name}) ) { warn "(debug) $attribute_name is non-zero ($raw_value) but less than $warn_list{$attribute_name}\n\n" if $opt_debug; - push(@error_messages, "$attribute_name is non-zero ($raw_value) (but less than threshold $warn_list{$attribute_name})"); + push(@notice_messages, "$attribute_name is non-zero ($raw_value) (but less than threshold $warn_list{$attribute_name})"); } else { warn "(debug) $attribute_name is non-zero ($raw_value)\n\n" if $opt_debug; - push(@error_messages, "$attribute_name is non-zero ($raw_value)"); + push(@warning_messages, "$attribute_name is non-zero ($raw_value)"); escalate_status('WARNING'); } } else { @@ -627,19 +640,19 @@ if ($opt_b) { push (@perfdata, "defect_list=$defectlist;;$opt_b") if $opt_d; if (($defectlist > 0) && ($defectlist >= $opt_b)) { - push(@error_messages, "$defectlist Elements in grown defect list (threshold $opt_b)"); + push(@warning_messages, "$defectlist Elements in grown defect list (threshold $opt_b)"); escalate_status('WARNING'); warn "(debug) Elements in grown defect list is non-zero ($defectlist)\n\n" if $opt_debug; } elsif (($defectlist > 0) && ($defectlist < $opt_b)) { - push(@error_messages, "Note: $defectlist Elements in grown defect list"); + push(@warning_messages, "Note: $defectlist Elements in grown defect list"); warn "(debug) Elements in grown defect list is non-zero ($defectlist) but less than $opt_b\n\n" if $opt_debug; } } else { if ($defectlist > 0) { push (@perfdata, "defect_list=$defectlist") if $opt_d; - push(@error_messages, "$defectlist Elements in grown defect list"); + push(@warning_messages, "$defectlist Elements in grown defect list"); escalate_status('WARNING'); warn "(debug) Elements in grown defect list is non-zero ($defectlist)\n\n" if $opt_debug; } @@ -667,7 +680,7 @@ push (@perfdata, "start_stop=$current_start_stop;$max_start_stop") if $opt_d; if($current_start_stop > $max_start_stop){ warn "(debug) Disk start_stop is greater than max ($current_start_stop > $max_start_stop)\n\n" if $opt_debug; - push(@error_messages, 'Disk start_stop is higher than maximum'); + push(@warning_messages, 'Disk start_stop is higher than maximum'); escalate_status('WARNING'); } } @@ -686,20 +699,39 @@ if($exit_status_local ne 'OK'){ if ($opt_g) { $status_string = $label.join(', ', @error_messages); + $status_string .= $label.join(', ', @warning_messages); + $status_string .= $label.join(', ', @notice_messages); } else { $drive_details = "Drive $model S/N $serial: "; - $status_string = join(', ', @error_messages); + $status_string = join(', ', @error_messages, ''); + $status_string .= join(', ', @warning_messages, ''); + $status_string .= join(', ', @notice_messages); + } + if ($exit_status_local eq 'WARNING') { + push @drives_status_warning, $status_string; + } elsif ($exit_status_local eq 'CRITICAL') { + push @drives_status_critical, $status_string; } - push @drives_status_not_okay, $status_string; - } + } else { if ($opt_g) { $status_string = $label."Device is clean"; + if (scalar(@error_messages) > 0) { + $status_string .= " ".$label.join(', ', @error_messages); + } + if (scalar(@warning_messages) > 0) { + $status_string .= " ".$label.join(', ', @warning_messages); + } + if (scalar(@notice_messages) > 0) { + $status_string .= " ".$label.join(', ', @notice_messages); + } } else { $drive_details = "Drive $model S/N $serial: no SMART errors detected. "; $status_string = join(', ', @error_messages); + $status_string .= join(', ', @warning_messages); + $status_string .= join(', ', @notice_messages); } push @drives_status_okay, $status_string; } @@ -710,6 +742,14 @@ my @msg_list = ($drive_details) if $drive_details; +if (scalar(@drives_status_critical) > 0) { + push @drives_status_not_okay, @drives_status_critical; +} + +if (scalar(@drives_status_warning) > 0) { + push @drives_status_not_okay, @drives_status_warning; +} + if (@drives_status_not_okay) { push @msg_list, grep { $_ } @drives_status_not_okay; } @@ -743,7 +783,7 @@ sub print_help { print_revision($basename,$revision); - print "\nUsage: $basename {-d=<block device>|-g=<block device glob>} -i=(auto|ata|scsi|3ware,N|areca,N|hpt,L/M/N|cciss,N|megaraid,N) [-r list] [-w list] [-b N] [-e list] [-E list] [--debug]\n\n"; + print "\nUsage: $basename {-d=<block device>|-g=<block device glob>} -i=(auto|ata|scsi|3ware,N|areca,N|hpt,L/M/N|aacraid,H,L,ID|cciss,N|megaraid,N) [-r list] [-w list] [-b N] [-e list] [-E list] [--debug]\n\n"; print "At least one of the below. -d supersedes -g\n"; print " -d/--device: a physical block device to be SMART monitored, eg /dev/sda. Pseudo-device /dev/bus/N is allowed.\n"; print " -g/--global: a glob pattern name of physical devices to be SMART monitored\n"; @@ -753,7 +793,7 @@ print "Note that -g only works with a fixed interface (e.g. scsi, ata) and megaraid,N.\n"; print "\n"; print "Other options\n"; - print " -i/--interface: device's interface type (auto|ata|scsi|nvme|3ware,N|areca,N|hpt,L/M/N|cciss,N|megaraid,N)\n"; + print " -i/--interface: device's interface type (auto|ata|scsi|nvme|3ware,N|areca,N|hpt,L/M/N|aacraid,H,L,ID|cciss,N|megaraid,N)\n"; print " (See http://www.smartmontools.org/wiki/Supported_RAID-Controllers for interface convention)\n"; print " -r/--raw Comma separated list of ATA or NVMe attributes to check\n"; print " ATA default: Current_Pending_Sector,Reallocated_Sector_Ct,Program_Fail_Cnt_Total,Uncorrectable_Error_Cnt,Offline_Uncorrectable,Runtime_Bad_Block,Command_Timeout\n"; ++++++ monitoring-plugins-smart-rpmlintrc ++++++ # the comment is used to have the package name in a comment for the sudo script addFilter("macro-in-comment");