mdadm error
"gulikoza" <[email protected]>
| Newsgroups | gmane.comp.log.logwatch.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi, If mdadm.conf has configured devices which do not exist, then logwatch will print: --------------------- Mdadm Begin ------------------------ mdadm: cannot open /dev/md0: No such file or directory Can't use an undefined value as an ARRAY reference at /usr/share/logwatch/scripts/services/mdadm line 83. /dev/md0 : ---------------------- Mdadm End ------------------------- This is only printed for the first invalid device. The attached patch checks for this error and prints the "No such file or directory error" for all invalid devices without the undefined value error. Regards, gulikoza ------------------------------------------------------------------------------ Open source business process management suite built on Java and Eclipse Turn processes into business applications with Bonita BPM Community Edition Quickly connect people, data, and systems into organized workflows Winner of BOSSIE, CODIE, OW2 and Gartner awards http://p.sf.net/sfu/Bonitasoft _______________________________________________ Logwatch-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/logwatch-devel
logwatch-mdadm.patch
(application/octet-stream, 754 B)
Index: scripts/services/mdadm
===================================================================
--- scripts/services/mdadm (revision 197)
+++ scripts/services/mdadm (working copy)
@@ -41,11 +41,17 @@
}
close(MDADM);
-foreach my $dev (@devices) {
+DEV: foreach my $dev (@devices) {
my %mdhash;
- open(MDADM,"mdadm --misc --detail $dev |");
+ open(MDADM,"mdadm --misc --detail $dev 2>&1 |");
while (<MDADM>) {
+ if ($_ =~ /cannot open .*: No such file or directory/) {
+ print $_;
+ close(MDADM);
+ next DEV;
+ }
+
$mdhash{'level'} = $1 if ($_ =~ /Raid Level ?: ?(.*)$/);
$mdhash{'active'} = $1 if ($_ =~ /Active Devices ?: ?(.*)$/);
$mdhash{'working'} = $1 if ($_ =~ /Working Devices ?: ?(.*)$/);