#!/usr/bin/perluse strict;use warnings; use lib "/usr/lib64/nagios/plugins"; use  UTILS QW (%errors);my $usage = "usage: $0 host_addr ipmi_user ipmi_passconnects to a dell bmc and parses the drive token For raid statusand disk slot errors. "; if (my $result = '/usr/bin/ipmitool chassis status 2>/dev/ null ') { my $err _lvl = 0; my $status = ""; my $key = "; foreach my $line ( split /\n/s, $result) { if (my @fields = split (/:/,$line)) { # print $fields [1]; # print $ fields[0]; chomp ($status = $fields [1]); chomp ($key = $fields [0]); if ($key =~ m/ Drive (\s+) fault/g ) { if ( $status =~ m/true/g) { $err _lvl++; } } } } if ($err _lvl > 0) { print "CRITICAL: hard disk is fault \n "; exit $ERRORS {' CRITICAL '} } else { print "ok: hard disks is ok \n"; exit $ERRORS {' OK '} }} else {
can be used. Can find the hard disk Fault in time
Then you can use
Ipmitool SEL List
Check logs
Nagios script to monitor hard disk failures