smartmontools

Roy, Patrick Patrick.Roy at ville.Quebec.qc.ca
Wed Jun 30 21:21:45 CEST 2004


Thanks! that script will solve 50% of my problem! Now if I could find
something for my windowze boxes... 

----------
De : Dan Urist [mailto:durist at euler.cr.usgs.gov]
Envoyé : 30 juin 2004 14:53
À : nagios-users at lists.sourceforge.net
Cc : Roy, Patrick
Objet : Re: [Nagios-users] smartmontools


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