====== Adaptec-Controller Check für "arcconf" ====== Lokaler Check, kopieren nach: /usr/lib/check_mk_agent/local/adaptec #!/bin/bash # # 08/2011 Matthias Henze # Lizenz: GPL v2 # # Check für Adaptec-Controlleer die von "arcconf" unterstützt werden # basis01:~# arcconf GETCONFIG 1 AD | grep Status # Controller Status : Optimal # Status : ZMM Optimal # basis01:~# arcconf GETCONFIG 1 AD | grep Model # Controller Model : Adaptec 6405 get_model () { MODEL=$(arcconf GETCONFIG $1 AD | grep Model | cut -d ":" -f 2) MODEL=${MODEL/ /} MODEL=${MODEL// /-} } for C in $(arcconf GETVERSION | grep "Controller #" | cut -d "#" -f 2) do get_model $C STATUS=$(arcconf GETCONFIG $C AD | grep "Controller Status" | cut -d ":" -f 2) TEXT="Controller: $C, Status: $STATUS" if [ "$STATUS" != "${STATUS/Optimal}" ]; then ST=0 else ST=2 fi arcconf GETCONFIG $C AD | grep -q "ZMM" >/dev/null if [ $? ]; then ZMM=$(arcconf GETCONFIG $C AD | grep "ZMM" | grep "Status" | cut -d ":" -f 2) TEXT="$TEXT, $ZMM" if [ "$STATUS" != "${STATUS/Optimal}" ]; then ST=$ST else ST=2 fi fi echo "$ST $MODEL - $TEXT" done #basis01:~# arcconf GETCONFIG 1 LD #Logical device number 0 # Logical device name : a1 # RAID level : 5 # Status of logical device : Optimal # Size : 5713910 MB for C in $(arcconf GETVERSION | grep "Controller #" | cut -d "#" -f 2) do get_model $C arcconf GETCONFIG $C LD | awk -v M=$MODEL -v C=$C -- ' BEGIN { N=0 } /Logical device number/ { N=N+1 LD[N,1]=$4 } /Logical device name/ { LD[N,2]=$5 } /RAID level/ { LD[N,3]=$4 } /Status of logical device/ { LD[N,4]=$6 } /Size/ { LD[N,5]=$3; LD[N,6]=$4 } END { for ( i=1; i<=N; i++ ) { if ( LD[i,4] == "Optimal" ) ST=0; else ST=2; printf("%s %s-LD-%s - Controller: %s, Logicaldrive: %s, Name: %s, RaidLevel: %s, Status: %s, Size: %s %s\n", ST,M,LD[i,1],C,LD[i,1],LD[i,2],LD[i,3],LD[i,4],LD[i,5],LD[i,6]) } }' done #basis01:~# arcconf GETCONFIG 1 PD # Device #0 # State : Online # Transfer Speed : SATA 6.0 Gb/s # Model : ST2000DL003-9VT1 # Size : 1907729 MB for C in $(arcconf GETVERSION | grep "Controller #" | cut -d "#" -f 2) do get_model $C arcconf GETCONFIG $C PD | awk -v M=$MODEL -v C=$C -- ' BEGIN { N=0 } /Device #/ { N=N+1; split($0,a,"#"); DR[N,1]=a[2] } / State / { DR[N,2]=$3 } /Transfer Speed/ { split($0,a,": "); DR[N,3]=a[2] } /Model/ { DR[N,4]=$3 } /Size/ { DR[N,5]=$3; DR[N,6]=$4 } END { for ( i=1; i<=N; i++ ) { if ( DR[i,2] == "Online" ) ST=0; else ST=2; printf("%s %s-DR-%s - Controller: %s, Drive: %s, State: %s, Speed: %s, Model: %s, Size: %s %s\n", ST,M,DR[i,1],C,DR[i,1],DR[i,2],DR[i,3],DR[i,4],DR[i,5],DR[i,6]) } } ' done Neue Version für neueres arcconf und neuere Controller: #!/bin/bash # # 08/2011 Matthias Henze # Lizenz: GPL v2 # # Check für Adaptec-Controlleer die von "/usr/local/bin/arcconf" unterstützt werden # basis01:~# /usr/local/bin/arcconf GETCONFIG 1 AD | grep Status # Controller Status : Optimal # Status : ZMM Optimal # basis01:~# /usr/local/bin/arcconf GETCONFIG 1 AD | grep Model # Controller Model : Adaptec 6405 get_model () { MODEL=$(/usr/local/bin/arcconf GETCONFIG $1 AD | grep Model | cut -d ":" -f 2) MODEL=${MODEL/ /} MODEL=${MODEL// /-} } for C in $(/usr/local/bin/arcconf GETVERSION | grep "Controller #" | cut -d "#" -f 2) do get_model $C STATUS=$(/usr/local/bin/arcconf GETCONFIG $C AD | grep "Controller Status" | cut -d ":" -f 2) TEXT="Controller: $C, Status: $STATUS" if [ "$STATUS" != "${STATUS/Optimal}" ]; then ST=0 else ST=2 fi /usr/local/bin/arcconf GETCONFIG $C AD | grep -q "ZMM" >/dev/null if [ $? ]; then ZMM=$(/usr/local/bin/arcconf GETCONFIG $C AD | grep "ZMM" | grep "Status" | cut -d ":" -f 2) TEXT="$TEXT, $ZMM" if [ "$STATUS" != "${STATUS/Optimal}" ]; then ST=$ST else ST=2 fi fi echo "$ST $MODEL - $TEXT" done #basis01:~# /usr/local/bin/arcconf GETCONFIG 1 LD #Logical device number 0 # Logical device name : a1 # RAID level : 5 # Status of logical device : Optimal # Size : 5713910 MB for C in $(/usr/local/bin/arcconf GETVERSION | grep "Controller #" | cut -d "#" -f 2) do get_model $C /usr/local/bin/arcconf GETCONFIG $C LD | awk -v M=$MODEL -v C=$C -- ' BEGIN { N=0 } /Logical device number/ { N=N+1 LD[N,1]=$4 } /Logical device name/ { LD[N,2]=$5 } /RAID level/ { LD[N,3]=$4 } /Status of logical device/ { LD[N,4]=$6 } /Size/ { LD[N,5]=$3; LD[N,6]=$4 } END { for ( i=1; i<=N; i++ ) { if ( LD[i,4] == "Optimal" ) ST=0; else ST=2; printf("%s %s-LD-%s - Controller: %s, Logicaldrive: %s, Name: %s, RaidLevel: %s, Status: %s, Size: %s %s\n", ST,M,LD[i,1],C,LD[i,1],LD[i,2],LD[i,3],LD[i,4],LD[i,5],LD[i,6]) } }' done #basis01:~# /usr/local/bin/arcconf GETCONFIG 1 PD # Device #3 # Device is a Hard drive # State : Hot Spare # State : Online # Supported : Yes # Transfer Speed : SAS 6.0 Gb/s # Reported Channel,Device(T:L) : 0,3(3:0) # Reported Location : Enclosure 0, Slot 3 # Reported ESD(T:L) : 2,0(0:0) # Vendor : SEAGATE # Model : ST1000NM0001 # Firmware : 0002 # Serial number : Z1N3VYDW0000C333E2UA # World-wide name : 5000C500563FD9FC # Reserved Size : 538264 KB # Used Size : 953344 MB # Unused Size : 64 KB # Total Size : 953869 MB # Write Cache : Enabled (write-back) # FRU : None # S.M.A.R.T. : No # S.M.A.R.T. warnings : 0 # Power State : Full rpm # Supported Power States : Full rpm,Powered off # SSD : No # .. im Fehlerfall # Failed logical device segments : True for C in $(/usr/local/bin/arcconf GETVERSION | grep "Controller #" | cut -d "#" -f 2) do get_model $C /usr/local/bin/arcconf GETCONFIG $C PD | awk -v M=$MODEL -v C=$C -- ' BEGIN { N=0 } /Device #/ { N=N+1; split($0,a,"#"); DR[N,1]=a[2] } /Device is/ { DR[N,99]=$4} / State / { DR[N,2]=$3" "$4 } /Transfer Speed/ { split($0,a,": "); DR[N,3]=a[2] } /Model/ { DR[N,4]=$3 } /Vendor/ { DR[N,5]=$3 } /Total Size/ { DR[N,6]=$4; DR[N,7]=$5 } /Failed logical device segments/ { DR[N,2] = "Failed logical device segments"} END { for ( i=1; i<=N; i++ ) { if ( DR[i,99] == "Hard" ) { ST=2; if ( DR[i,2] == "Online " ) ST=0; if ( DR[i,2] == "Hot Spare" ) ST=0; if ( DR[i,2] == "Rebuilding" ) ST=1; if ( DR[i,2] == "Ready" ) ST=1; printf("%s %s-DR-%s - Controller: %s, Drive: %s, State: %s, Speed: %s, Model: %s %s, Size: %s %s\n", ST,M,DR[i,1],C,DR[i,1],DR[i,2],DR[i,3],DR[i,5],DR[i,4],DR[i,6],DR[i,7]) } } } ' done S.M.A.R.T. Client-Plugin für Adaptec-Controller #!/bin/bash if which smartctl > /dev/null 2>&1 ; then echo '<<>>' for D in /dev/sg*; do # strip device name for final output DNAME=${D#/dev/} VEND="unkonown" MODEL=$(smartctl -a -d sat $D | grep -i "device model" | sed -e "s/.*:[ ]*//g" -e "s/\ /_/g") CMD="smartctl -d sat -v 9,raw48 -A $D" [ -n "$CMD" ] && $CMD | grep Always | egrep -v '^190(.*)Temperature(.*)' | sed "s|^|$DNAME $VEND $MODEL |" done 2>/dev/null fi