packages: nagios-plugin-check_raid/check_raid patch from Ba rtłomiej Korupc ...
glen
glen at pld-linux.org
Tue Sep 13 07:42:17 CEST 2011
Author: glen Date: Tue Sep 13 05:42:17 2011 GMT
Module: packages Tag: HEAD
---- Log message:
patch from Bartłomiej Korupczyński <bartek#net-serwis.pl>:
call arcconf once only; sudo command changed to end with "AL"
I've made patch for nagios-plugin-check_raid to invoke arcconf only once
instead of twice (each invocation takes about 5 seconds). Applies cleanly
against CVS rev 1.96.
---- Files affected:
packages/nagios-plugin-check_raid:
check_raid (1.96 -> 1.97)
---- Diffs:
================================================================
Index: packages/nagios-plugin-check_raid/check_raid
diff -u packages/nagios-plugin-check_raid/check_raid:1.96 packages/nagios-plugin-check_raid/check_raid:1.97
--- packages/nagios-plugin-check_raid/check_raid:1.96 Thu Aug 25 15:44:49 2011
+++ packages/nagios-plugin-check_raid/check_raid Tue Sep 13 07:42:12 2011
@@ -662,20 +662,16 @@
chdir('/var/log') || chdir('/');
my ($fh, $d);
- open($fh , '-|', @CMD, 'GETCONFIG', '1', 'LD') or return;
+ open($fh , '-|', @CMD, 'GETCONFIG', '1', 'AL') or return;
while (<$fh>) {
- $d = $1, next if /^Logical device number (\d+)/;
- next unless (my ($s) = /^\s*Status of logical device\s+:\s+(.+)/);
- push(@status, "Logical Device $d:$s");
+ last if /^Controller information/;
}
- close $fh;
-
- open($fh , '-|', @CMD, 'GETCONFIG', '1', 'AD') or return;
+ # Controller information
while (<$fh>) {
+ last if /^Logical device information/;
+
if (my($s) = /Controller Status\s*:\s*(.*)/) {
- if ($s ne 'Optimal') {
- $status = $ERRORS{CRITICAL};
- }
+ $status = $ERRORS{CRITICAL} if ($s ne 'Optimal');
push(@status, "Controller:$s");
next;
}
@@ -700,7 +696,6 @@
if (my($s) = /^\s*Status\s*:\s*(.*)$/) {
next if $s eq "Not Installed";
-
push(@status, "Battery Status: $s");
next;
}
@@ -736,11 +731,19 @@
if ($mins < 60) {
push(@status, "Battery Time: ${m}m");
} else {
- push(@status, "Battery Time: ${d}d, ${h}h, ${m}m");
+ push(@status, "Battery Time: ${d}d${h}h${m}m");
}
next;
}
}
+ # Logical device information
+ while (<$fh>) {
+ last if /^Physical Device information/;
+ $d = $1, next if /^Logical device number (\d+)/;
+ next unless (my ($s) = /^\s*Status of logical device\s+:\s+(.+)/);
+ push(@status, "Logical Device $d:$s");
+ }
+ # Physical Device information
close $fh;
$message .= "arcconf:".join(', ', @status) if @status;
@@ -1182,7 +1185,7 @@
push(@sudo, "CHECK_RAID ALL=(root) NOPASSWD: $mpt_status -s\n") if $mpt_status and -d "/proc/mpt";
push(@sudo, "CHECK_RAID ALL=(root) NOPASSWD: $cat /proc/megaide/0/status\n") if -d "/proc/megaide/0";
push(@sudo, "CHECK_RAID ALL=(root) NOPASSWD: $cat /proc/megaide/1/status\n") if -d "/proc/megaide/1";
- push(@sudo, "CHECK_RAID ALL=(root) NOPASSWD: $arcconf GETCONFIG 1 *\n") if $arcconf;
+ push(@sudo, "CHECK_RAID ALL=(root) NOPASSWD: $arcconf GETCONFIG 1 AL\n") if $arcconf;
push(@sudo, "CHECK_RAID ALL=(root) NOPASSWD: $megarc -AllAdpInfo -nolog\n") if $megarc;
push(@sudo, "CHECK_RAID ALL=(root) NOPASSWD: $megarc -dispCfg -a* -nolog\n") if $megarc;
push(@sudo, "CHECK_RAID ALL=(root) NOPASSWD: $cmdtool2 -AdpAllInfo -aALL -nolog\n") if $cmdtool2;
================================================================
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/nagios-plugin-check_raid/check_raid?r1=1.96&r2=1.97&f=u
More information about the pld-cvs-commit
mailing list