smartmontools
Dan Urist
durist at euler.cr.usgs.gov
Wed Jun 30 20:53:15 CEST 2004
On Wednesday 30 June 2004 12:16, Roy, Patrick wrote:
> Hi! Does anyone have a script or a plugging that can use
> smartmontools (or any other multi-platform disk monitoring software) to
> verify disk integrity? My google search was unsuccessful.
Here's a simple perl script that I run with the check_by_ssh plugin; you need
lshw as well as smarttools:
#!/usr/bin/perl -w
my $SMARTCTL = "/usr/sbin/smartctl";
my $LSHW = "/usr/sbin/lshw";
open(LSHW, "$LSHW -class disk|")
or die "$0: Could not open pipe to lshw";
my @baddisks;
while( my $line = <LSHW> ){
if( $line =~ /^\s+\*-disk/ ){
while ($line = <LSHW>){
if( $line =~ /^\s+logical name:\s+(\S+)/ ){
system("$SMARTCTL -c $1 > /dev/null 2>&1");
push(@baddisks, $1) if $?;
last;
}
}
}
}
if( scalar(@baddisks) ){
print "Bad Disks: ", join(",", at baddisks), "\n";;
exit 1;
}
--
Dan Urist
durist at euler.cr.usgs.gov
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list