#!/usr/bin/perl
use strict;
use warnings;
use lib "/usr/lib64/nagios/plugins"; nagios安装
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)){ nagios配置
# 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'} nagios实施
}
} else {
可以用。能及时发现硬盘的故障
然后可以用
ipmitool sel listnagios培训
检查日志
想做Nagios, Zabbix,Cacti,iTop各种交流的,可以进入开源监控工具Nagios交流 QQ群号 :476809427
|