Module: check_mk
Branch: master
Commit: ea85d88a23a7d4d72baffd267f118ba5ed52e659
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ea85d88a23a7d4…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Feb 23 12:53:52 2012 +0100
FIX: smart plugin: handle cases with missing vendor
---
ChangeLog | 2 ++
agents/plugins/smart | 20 +++++++++++++++++---
2 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 92a90a5..353c5a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -59,6 +59,8 @@
alarms.
* postfix_mailq: handle output with 'Total requests:' in last line
* FIX: check_mk-hp_blade_psu.php: allow more than 4 power supplies
+ * FIX: smart plugin: handle cases with missing vendor (thanks
+ to Stefan Kärst)
Multisite:
* Added several missing localization strings
diff --git a/agents/plugins/smart b/agents/plugins/smart
index 220fef6..caeb769 100755
--- a/agents/plugins/smart
+++ b/agents/plugins/smart
@@ -5,8 +5,22 @@ if which smartctl > /dev/null 2>&1 ; then
echo '<<<smart>>>'
for D in /dev/[sh]d[a-z] /dev/[sh]d[a-z][a-z]; do
N=${D##*/}
- VEND=$(tr -d ' ' < /sys/block/$N/device/vendor)
- MODEL=$(sed -e 's/ /_/g' -e 's/_*$//g' <
/sys/block/$N/device/model)
- smartctl -A $D | grep Always | sed "s|^|$D $VEND $MODEL |"
+ if [ -r /sys/block/$N/device/vendor ]; then
+ VEND=$(tr -d ' ' < /sys/block/$N/device/vendor)
+ else
+ # 2012-01-25 Stefan Kaerst CDJ - in case $N does not exist
+ VEND=ATA
+ fi
+ # 2012-01-25 Stefan Kaerst CDJ - special option in case vendor is AMCC
+ if [ "$VEND" == "AMCC" ]; then
+ D='/dev/twa0'
+ SPECOPS='-d 3ware,0'
+ fi
+ if [ -r /sys/block/$N/device/model ]; then
+ MODEL=$(sed -e 's/ /_/g' -e 's/_*$//g' <
/sys/block/$N/device/model)
+ else
+ MODEL=$(smartctl -a $D | grep -i "device model" | sed -e
"s/.*:[ ]*//g" -e "s/\ /_/g")
+ fi
+ smartctl $SPECOPS -v 9,raw48 -A $D | grep Always | egrep -v
'^190(.*)Temperature(.*)' | sed "s|^|$D $VEND $MODEL |"
done 2>/dev/null
fi