����JFIF��x�x����'
| Server IP : 78.140.185.180 / Your IP : 216.73.216.170 Web Server : LiteSpeed System : Linux cpanel13.v.fozzy.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : builderbox ( 1072) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /usr/lib64/nagios/plugins/base/ |
Upload File : |
#!/usr/bin/env perl
use Getopt::Long;
my $ARCCONF = '/usr/sbin/arcconf';
my @INFO = `sudo $ARCCONF getconfig 1`;
my $battery = undef; # ignore battery warnings
GetOptions( battery => \$battery ) || do {
print "Failed to parse command line arguments\n";
exit 3;
};
if ( !@INFO || $? ) {
print "Can't get info from arcconf\n";
exit 3;
}
my ($CONTROLLER) = map {/:\s(.*)/} grep /Controller Status/i, @INFO;
my ($BATTERY) = map {/:\s(.*)/} grep /^\s+Status/i, @INFO;
my ($LD) = map {/:\s(.*)/} grep /Status of logical device/i, @INFO;
my @PD_INFO = grep /Device #| Serial| State|S.M.A.R.T/i, @INFO;
my ( %PD, @warnings, $num );
push @warnings, "Controller: $CONTROLLER" if $CONTROLLER !~ /^Optimal|^OK/i;
push @warnings, "Battery: $BATTERY" if $BATTERY !~ /Optimal|Charging/i && !$battery;
push @warnings, "LD: $LD" if $LD !~ /^Optimal/i;
for my $line (@PD_INFO) {
$num = $1 if $line =~ m{Device #(\d+)};
if ( $line =~ /State\s+:\s(.*)/i ) {
$PD{$num}{state} = $1;
}
if ( $line =~ /Serial number\s+:\s(.*)/i ) {
$PD{$num}{serial} = $1;
}
if ( $line =~ /S.M.A.R.T.\s+:\s(.*)/i ) {
$PD{$num}{smart} = $1;
}
if ( $line =~ /S.M.A.R.T. warnings\s+:\s(.*)/i ) {
$PD{$num}{smart_count} = $1;
if ( $PD{$num}{smart} =~ /Yes/i
|| $PD{$num}{state} !~ /^Online|.*hot.spare.*/i )
{
push @warnings,
"Warning: disk in slot $num in state $PD{$num}{state}; Smart warnings $PD{$num}{smart_count}; Serial: $PD{$num}{serial}";
}
}
}
print join "\n", @warnings;
exit 1 if @warnings;
print "aacraid OK\n";