Pages

Friday, November 14, 2014

HP Smart Array RAID status on CentOS

(1) You can download the rpm from here:

 wget ftp://ftp.hp.com/pub/softlib2/software1/pubsw-linux/p1257348637/v71527/hpacucli-9.10-22.0.x86_64.rpm

Check the controller status
-----------------------------
#hpacucli controller all show status

Check the logical drive
------------------------
#hpacucli controller slot=0 logicaldrive all show status

Check the physical drives
--------------------------
hpacucli controller slot=0 physicaldrive all show status


Adaptec Raid Monitoring


You can download the source from here

http://download.adaptec.com/raid/storage_manager/asm_linux_x64_v7_31_18856.tgz

/usr/StorMan/arcconf getconfig 1


/opt/adaptec-monitor.pl
===================
#!/usr/bin/perl -w
# adaptec-monitor.sh - Monitors Adaptec Hardware RAID

use strict;
open(my $arcout, "/usr/StorMan/arcconf getconfig 1|") or die $!;
my @arcout;
while(<$arcout>) {
chomp;
push(@arcout,$_);

}
close($arcout);

my $cont_trouble;
my %disk_trouble;
my $disk_number;

for(@arcout) {
if(/Status of logical device\s+:\s+(Degraded|Missing|SMART-ERROR|Offline|Warning|Critical|Bad|Unknown|Device-Error)/) {
$cont_trouble = $1;
}
if(/Device #(\d+)/) {
$disk_number = $1;
}
if (/State\s+:\s+(Degraded|Missing|SMART-ERROR|Offline|Warning|Critical|Bad|Unknown|Device-Error)/) {
$disk_trouble{ $disk_number } = $1;
}
}

if($cont_trouble) {
&mailit($cont_trouble);
}

while ( my ($key, $value) = each(%disk_trouble) ) {
&mailit($key,$value);
}

sub mailit {

my $title='RAID Issue!';
my $to='<email_id>';
my $from= 'root@server';
my $subject='RAID issue detected on hostname';

open(MAIL, "|/usr/sbin/sendmail -t");

## Mail Header
print MAIL "To: $to\n";
print MAIL "From: $from\n";
print MAIL "Subject: $subject\n\n";
## Mail Body
if ($_[1]) {
print MAIL "Disk Status: #$_[0]: $_[1]\n";
}
else { print MAIL "Controller Status: $_[0]\n" }
close(MAIL);

}


[root@op1 backup]# crontab -l
* */1 * * * /usr/bin/perl /opt/adaptec-monitor.pl

ARP

Current arp cache
==============
root@server [~]# arp -n
Address      HWtype  HWaddress           Flags Mask  Iface
70.167.140.1 ether   00:00:0C:9F:F0:04   C           eth0

Clearing arp cache with verbose
======================
root@server [~]# ip -s -s neigh flush all
70.167.140.1 dev eth0 lladdr 00:00:0c:9f:f0:04 ref 42 used 17/0/65 REACHABLE
*** Round 1, deleting 1 entries ***
70.167.140.1 dev eth0  ref 42 used 0/0/0 INCOMPLETE
*** Round 2, deleting 1 entries ***
*** Flush is complete after 2 rounds ***

Current entries
============
root@server [~]# arp -n
Address      HWtype  HWaddress           Flags Mask  Iface
69.167.140.1 ether   00:00:0C:9F:F0:04   C           eth0

Delete specific arp entries
==================
root@server [~]# arp -d 192.168.1.1
root@server [~]# arp -d 192.168.1.2

Add a static arp entry
===================
root@server [~]# arp -s 192.168.1.10 00:00:93:12:04:57