Module: check_mk
Branch: master
Commit: 70ddb46c2c5e856d65091341d3d33d6aaf965d3e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=70ddb46c2c5e85…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Dec 4 12:56:32 2014 +0100
#1630 smart: update in plugin that also outputs information about disks attached to a
MegaRAID controller
Thanks to Florian Heigl
---
.werks/1630 | 9 +++++++++
ChangeLog | 1 +
agents/plugins/smart | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 62 insertions(+)
diff --git a/.werks/1630 b/.werks/1630
new file mode 100644
index 0000000..ee15952
--- /dev/null
+++ b/.werks/1630
@@ -0,0 +1,9 @@
+Title: smart: update in plugin that also outputs information about disks attached to a
MegaRAID controller
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.5i7
+Date: 1417694156
+Class: feature
+
+Thanks to Florian Heigl
diff --git a/ChangeLog b/ChangeLog
index 44b2f22..0bf94f4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -49,6 +49,7 @@
* 1626 Renamed service descriptions of filesystem, process and logwatch checks...
* 1627 megaraid_ldisks: Warn if current cache or write policy differs from logical
drive default policy...
* 1629 check_mk_agent.freebsd: several new features and improvements, now only use
statgrab...
+ * 1630 smart: update in plugin that also outputs information about disks attached to
a MegaRAID controller...
* 1478 FIX: kernel.util, statgrab_cpu: fix computation of utilization...
* 1480 FIX: brocade_vdx_status: disable check on some devices that do not support
it...
* 1485 FIX: dell_om_disks, dell_om_esmlog, dell_om_mem, dell_om_processors,
dell_om_sensors: detect more devices...
diff --git a/agents/plugins/smart b/agents/plugins/smart
index 3b5faf2..1a0f250 100755
--- a/agents/plugins/smart
+++ b/agents/plugins/smart
@@ -23,6 +23,51 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
+
+
+
+# This will be called on LSI based raidcontrollers and accesses
+# the SMART data of SATA disks attached to a SAS Raid HBA via
+# SCSI protocol interface.
+megaraid_info()
+{
+
+ PDINFO=$(MegaCli -PDlist -a0)
+
+ echo "$PDINFO" | \
+ while read line ; do
+ case "$line" in
+ # FIRST LINE
+ "Enclosure Device ID"*) #Enclosure Device ID: 252
+ ENC=$( echo "$line" | awk '{print $4}')
+ unset SLOT LOG_DEV_ID VEND MODEL
+ ;;
+ "Slot Number"*) #Slot Number: 7
+ SLOT=$( echo "$line" | awk '{print $3}')
+ ;;
+ # Identify the logical device ID. smartctl needs it to access the disk.
+ "Device Id"*) #Device Id: 19
+ LOG_DEV_ID=$( echo "$line" | awk '{print $3}')
+ ;;
+ "PD Type"*) #PD Type: SATA
+ VEND=$( echo "$line" | awk '{print $3}')
+ ;;
+ # This is the last value, generate output here
+ "Inquiry Data"*)
+ #Inquiry Data: WD-WCC1T1035197WDC WD20EZRX-00DC0B0 80.00A80
+ # $4 seems to be better for some vendors... wont be possible to get this
perfect.
+ MODEL=$( echo "$line" | awk '{print $3}')
+
+ # /dev/sdc ATA SAMSUNG_SSD_830 5 Reallocated_Sector_Ct 0x0033 100 100
010 Pre-fail Always -
+ smartctl -d megaraid,${LOG_DEV_ID} -v 9,raw48 -A /dev/sg0 | \
+ grep Always | egrep -v '^190(.*)Temperature(.*)' | \
+ sed "s|^|Enc${ENC}/Slot${SLOT} $VEND $MODEL |"
+ ;;
+ esac
+ done
+}
+
+
# Only handle always updated values, add device path and vendor/model
if which smartctl > /dev/null 2>&1 ; then
#
@@ -106,4 +151,11 @@ if which smartctl > /dev/null 2>&1 ; then
[ -n "$CMD" ] && $CMD | grep Always | egrep -v
'^190(.*)Temperature(.*)' | sed "s|^|$DNAME $VEND $MODEL |"
done 2>/dev/null
+
+
+ # Call MegaRaid submodule if conditions are met
+ if which MegaCli > /dev/null && [ -c /dev/sg0 ] ; then
+ megaraid_info
+ fi
fi
+