packages: nagios-plugin-check_raid/check_raid - MSA volumes check from /sys...
glen
glen at pld-linux.org
Tue Oct 20 20:52:36 CEST 2009
Author: glen Date: Tue Oct 20 18:52:36 2009 GMT
Module: packages Tag: HEAD
---- Log message:
- MSA volumes check from /sys
- write PID to uucp lockfile
---- Files affected:
packages/nagios-plugin-check_raid:
check_raid (1.61 -> 1.62)
---- Diffs:
================================================================
Index: packages/nagios-plugin-check_raid/check_raid
diff -u packages/nagios-plugin-check_raid/check_raid:1.61 packages/nagios-plugin-check_raid/check_raid:1.62
--- packages/nagios-plugin-check_raid/check_raid:1.61 Sun Oct 18 13:29:27 2009
+++ packages/nagios-plugin-check_raid/check_raid Tue Oct 20 20:52:31 2009
@@ -794,17 +794,29 @@
$message .= "cciss: ".join(', ', @status) if @status;
}
+# check from /sys if there are any MSA VOLUME's present.
+sub sys_have_msa {
+ for my $file (</sys/block/*/device/model>) {
+ open my $fh, '<', $file or next;
+ my $model = <$fh>;
+ close($fh);
+ return 1 if ($model =~ /^MSA.+VOLUME/);
+ }
+ return 0;
+}
+
sub check_hp_msa {
- my $device = "/dev/ttyS0";
+ # TODO: unhardcode out modem dev
+ my $ctldevice = "/dev/ttyS0";
# status messages pushed here
my @status;
- my $modem = new SerialLine($device);
+ my $modem = new SerialLine($ctldevice);
my $fh = $modem->open();
unless ($fh) {
$status = $ERRORS{WARNING} unless $status;
- $message .= "hp_msa: Can't open $device";
+ $message .= "hp_msa: Can't open $ctldevice";
return;
}
@@ -1050,8 +1062,8 @@
check_megarc if $megarc;
check_cmdtool2 if $cmdtool2;
check_cciss if -d "/proc/driver/cciss";
-# TODO: better detect, unhardcode out modem dev
-check_hp_msa if -e "/dev/mail_storage/spool"; # pretty stupid test
+check_hp_msa if sys_have_msa;
+
if ($message) {
if ($status == $ERRORS{OK}) {
@@ -1100,6 +1112,7 @@
return 0;
}
open(my $fh, '>', $lockfile) || croak "Can't create lock: $lockfile\n";
+ print $fh $$;
close($fh);
$self->{lockfile} = $lockfile;
================================================================
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/nagios-plugin-check_raid/check_raid?r1=1.61&r2=1.62&f=u
More information about the pld-cvs-commit
mailing list