星期四, 9月 20, 2012

Setup Adaptec SATA RAUD HBA monitoring for Linux

長期以來一直使用Adaptec AAR-2410SA PCI SATA 4channel 作為 Linux File System Server硬硬資料保護,不過很困擾的是他的硬碟錯誤偵測不是很強還滿常需要人為介入作進一步問題的檢查,比如說硬碟壞軌,硬碟離線等。

必需加入遠端Monitor機制才能提早發現硬碟問題,在作了些功課後決定使用SNMP(sample network manager protocol)。

Drive部份直到CentOS6.3都還有內建aacraid的module。
Download appliance部份 http://ftp.dell.com/scsi-raid/afa-apps-snmp.2807420-a04.tar.gz
Download ucd-snmp source code http://nchc.dl.sourceforge.net/project/net-snmp/ucd-snmp/4.2.7.1/ucd-snmp-4.2.7.1.tar.gz

準備compiler "ucd-snmp-4.x.x" source code:
tar vxzf ucd-snmp-4.2.7.1.tar.gz
cd ucd-snmp-4.2.7
$ ./configure --enable-reentrant --with-mib-modules=agentx
$make
$make install

編寫 snmpd.conf
vi /usr/local/share/snmp/snmpd.conf and add below two lines:

master  agentx
pass .1.3.6.1.4.1.795 /usr/sbin/afasnmpd


準備安裝AAR-2410SA monitor tool:
tar vxzf afa-apps-snmp.2807420-a04.tar.gz
rpm -ihv afaapps-4.1-0.i386.rpm
rpm -ihv afasnmp-4.0-0.i386.rpm
vi /usr/local/share/snmp/afasnmpd.conf

trapcommunity "public"
trapsink localhost
trapsink [HOSTNAME]


CentOS系統本身不會自動產生/dev/afa0 檔,而這個檔是afacli cli必需存取的介面,可以透過以下步驟達成自動產生/dev/afa0:
cp MAKEDEV.afa /sbin/

vi /sbin/MAKEDEV.afa # make sure MAKEDEV.afa cd's /dev 
加入udev 設定檔
vi /etc/udev/rules.d/99-local.rules​

BUS=="pci", DRIVERS=="aacraid", PROGRAM="/sbin/MAKEDEV.afa afa0"

修改開機引導程式:
vi /etc/init.d/afasnmpd, 加入藍色部份:
....

case "$1" in
  start)
        echo -n "Starting snmpd: "
        /usr/local/sbin/snmpd
        sleep 2
        echo -n "Starting afasnmpd: "
        daemon /usr/sbin/afasnmpd
        RETVAL=$?
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/afasnmpd
        echo
        ;;
  stop)
        echo -n "Shutting down afasnmpd: "
        killproc afasnmpd
        RETVAL=$?
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/afasnmpd
        echo
        echo -n "Shutting down snmpd: "
        killproc snmpd
        ;;
....

收尾:


/sbin/chkconfig --add afasnmpd
/sbin/chkconfig --level 35 afasnmpd on

測試:
本地端 CentOS
snmpwalk localhost -c public -v2c enterprises.795.3.5

遠端 Ubuntu
snmpwalk [IP] -c public -v2c iso.3.6.1.4.1.795.3.5

SNMP OUTPUT


enterprises.795.3.5.1.0 = "AAC SNMP Version: 2.8-0 (Build #6076)"
enterprises.795.3.5.2.0 = 1
enterprises.795.3.5.3.1.1.1 = 1
enterprises.795.3.5.3.1.2.1 = "AFA0"
enterprises.795.3.5.3.1.3.1 = "No Info"
enterprises.795.3.5.3.1.4.1 = "File System: 1.1-7 (Build #28000)Miniport: 1.1-7 (Build #28000)Software: 4.2-0 (Build #8209)BIOS: 4.2-0 (Build #8209)Hardware: 2.64"
enterprises.795.3.5.3.1.5.1 = 2
enterprises.795.3.5.3.1.6.1 = 5
enterprises.795.3.5.3.1.7.1 = "BIOS Version: 4.2-0 (Build #8209)"
enterprises.795.3.5.3.1.8.1 = "Kernel Version: 4.2-0 (Build #8209)"
enterprises.795.3.5.3.1.9.1 = "Monitor Version: 4.2-0 (Build #8209)"
enterprises.795.3.5.3.1.10.1 = "Hardware Version: 2.64"
enterprises.795.3.5.3.1.11.1 = 67108864
enterprises.795.3.5.3.1.12.1 = 16777216
enterprises.795.3.5.3.1.13.1 = 50331648
enterprises.795.3.5.4.1.1.1 = 1
enterprises.795.3.5.4.1.2.1 = 1
enterprises.795.3.5.4.1.3.1 = 0
enterprises.795.3.5.4.1.4.1 = 238471
enterprises.795.3.5.4.1.5.1 = "/dev/sdh"
enterprises.795.3.5.4.1.6.1 = "Mirror"
enterprises.795.3.5.4.1.7.1 = "Valid"
enterprises.795.3.5.4.1.8.1 = 5
enterprises.795.3.5.4.1.9.1 = 0
enterprises.795.3.5.5.1.1.1 = 1
enterprises.795.3.5.5.1.1.2 = 2
enterprises.795.3.5.5.1.2.1 = 1
enterprises.795.3.5.5.1.2.2 = 1
enterprises.795.3.5.5.1.3.1 = 0
enterprises.795.3.5.5.1.3.2 = 0
enterprises.795.3.5.5.1.4.1 = 0
enterprises.795.3.5.5.1.4.2 = 1
enterprises.795.3.5.5.1.5.1 = 0
enterprises.795.3.5.5.1.5.2 = 0
enterprises.795.3.5.5.1.6.1 = 0
enterprises.795.3.5.5.1.6.2 = 0
enterprises.795.3.5.5.1.7.1 = "ST325082"
enterprises.795.3.5.5.1.7.2 = "ST325082"
enterprises.795.3.5.5.1.8.1 = "4AS             "
enterprises.795.3.5.5.1.8.2 = "3AS             "
enterprises.795.3.5.5.1.9.1 = "3.AA"
enterprises.795.3.5.5.1.9.2 = "3.03"
enterprises.795.3.5.5.1.10.1 = 488397168
enterprises.795.3.5.5.1.10.2 = 488397168
enterprises.795.3.5.5.1.11.1 = 512
enterprises.795.3.5.5.1.11.2 = 512
enterprises.795.3.5.5.1.12.1 = "Initialized."
enterprises.795.3.5.5.1.12.2 = "Initialized."
enterprises.795.3.5.5.1.13.1 = 3
enterprises.795.3.5.5.1.13.2 = 3
enterprises.795.3.5.6.1.1.1 = 1
enterprises.795.3.5.6.1.1.2 = 2
enterprises.795.3.5.6.1.2.1 = 1
enterprises.795.3.5.6.1.2.2 = 1
enterprises.795.3.5.6.1.3.1 = 1
enterprises.795.3.5.6.1.3.2 = 1
enterprises.795.3.5.6.1.4.1 = 2
enterprises.795.3.5.6.1.4.2 = 1
enterprises.795.3.5.6.1.5.1 = 65536
enterprises.795.3.5.6.1.5.2 = 0
enterprises.795.3.5.6.1.6.1 = 0
enterprises.795.3.5.6.1.6.2 = 0
enterprises.795.3.5.6.1.7.1 = 946995200
enterprises.795.3.5.6.1.7.2 = 946995200
enterprises.795.3.5.6.1.8.1 = 0
enterprises.795.3.5.6.1.8.2 = 0


官方參考連結:
https://cs.uwaterloo.ca/~brecht/servers/docs/PowerEdge-2600/en/Perc3di/snmp.htm#1107168