标签:
#!/usr/bin/perl use strict; use warnings; use lib "/usr/lib64/nagios/plugins"; use utils qw(%ERRORS); my $usage = " Usage: $0 host_addr ipmi_user ipmi_pass Connects to a Dell BMC and parses the Drive token for RAID status and 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 {
可以用。能及时发现硬盘的故障
然后可以用
ipmitool sel list
检查日志
标签:
原文地址:http://my.oschina.net/brinlike/blog/501654