Skip to content

Commit 7354d7b

Browse files
authored
Merge pull request #196 from lisuml/check_ssd_micron_support
Add support for Micron SSDs
2 parents 130680d + 7920c31 commit 7354d7b

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

templates/plugins/check_ssd

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
# NVMe functionality added by Lukas de Boer <[email protected]>
44
#
55
# This script needs work:
6-
# We assume Samsung SSDs or Intel SSDs
7-
# We assume 'Wear_Leveling_Count' or 'Media_Wearout_Indicator' (can be different for different manufacturers)
6+
# We assume Samsung SSDs, Intel SSDs or Micron SSDs
7+
# We assume 'Wear_Leveling_Count', 'Media_Wearout_Indicator' or
8+
# 'Percent_Lifetime_Remain' (can be different for different manufacturers)
89
#
910
# According to http://www.anandtech.com/show/8239/update-on-samsung-850-pro-endurance-vnand-die-size
1011
# a drive should continue to work fine even when the value reaches 0, because:
@@ -49,7 +50,7 @@ PREFIX="SSD OK"
4950
TESTMODE=0
5051
DEBUG=0
5152
HAS_SSD=0
52-
BRAND="SAMSUNG\|INTEL"
53+
BRAND="SAMSUNG\|INTEL\|MICRON"
5354
WARNING=10
5455
CRITICAL=5
5556
NOSSD=0
@@ -96,7 +97,7 @@ case $i in
9697
echo -e ""
9798
echo -e "-c=, --card= Instead of autodetecting using lspci, set the card type. We accept \"lsi\", \"3ware\" and \"auto\" for now. Auto is autodetect"
9899
echo -e "-d=, --device= The blockdevice we should use for calling smartmontools. Can be any blockdevice in /dev, but is driver specific"
99-
echo -e "-b=, --brand= The brand of SSD to search for. We accept \"samsung\" and \"intel\""
100+
echo -e "-b=, --brand= The brand of SSD to search for. We accept \"samsung\", \"intel\" and \"micron\""
100101
echo -e ""
101102
echo -e "-d, --debug Enable debug output"
102103
echo -e "-t, --test Only test if there are SSDs present in the system. exits with 0 when found, 1 if not"
@@ -265,37 +266,37 @@ function checkDID () {
265266
fi
266267
temperature=$($NVMECLI smart-log "$d" | awk -F'[\t ]+' '/^temperature/ {print $3}')
267268
else
268-
VALUE=$($SMARTCTL -A -d auto "$d" | awk '/^233/ || /^177/ { gsub ("^0*", "", $4); print $4}')
269+
VALUE=$($SMARTCTL -A -d auto "$d" | awk '/^233/ || /^177/ || /^202/ { gsub ("^0*", "", $4); print $4}')
269270
fi
270271
else
271272
if [ "$DRIVER" = "megaraid" ]; then
272273
DRIVER="sat+megaraid"
273274
fi
274-
VALUE=$(echo "$($SMARTCTL -A -d $DRIVER,"$d" "${BLOCKDEVICE[$1]}" | grep "^177\|^233" | head -n1 | awk '{ print $4 }')")
275+
VALUE=$(echo "$($SMARTCTL -A -d $DRIVER,"$d" "${BLOCKDEVICE[$1]}" | grep "^177\|^202\|^233" | head -n1 | awk '{ print $4 }')")
275276
[ ! -z ${VALUE} ] && VALUE=$(echo ${VALUE} + 0 | bc)
276277
fi
277278

278279
if [ ! -z ${VALUE} ]; then
279280
if [[ ${VALUE} -lt ${CRITICAL} ]]; then
280-
MESSAGE+="Drive $d on $1 CRITICAL WLC/MWI ($VALUE). "
281+
MESSAGE+="Drive $d on $1 CRITICAL WLC/MWI/PLR ($VALUE). "
281282
EXITCODE=2
282283
PREFIX="SSD CRITICAL"
283284
elif [[ ${VALUE} -lt ${WARNING} ]]; then
284-
MESSAGE+="Drive $d on $1 MEDIUM WLC/MWI ($VALUE). "
285+
MESSAGE+="Drive $d on $1 MEDIUM WLC/MWI/PLR ($VALUE). "
285286
if [ "$EXITCODE" -eq "0" ]; then
286287
EXITCODE=1
287288
PREFIX="SSD WARNING"
288289
fi
289290
else
290-
MESSAGE+="Drive $d on $1 WLC/MWI $VALUE. "
291+
MESSAGE+="Drive $d on $1 WLC/MWI/PLR $VALUE. "
291292
fi
292293
# ADD PERF DATA
293294
PERF_DATA+="Drive_${1}_${d}=${VALUE}% "
294295
if [ -n "$temperature" ] && [ "$temperature" -gt 0 ]; then
295296
PERF_DATA+="Drive_${1}_${d}_temp=$temperature "
296297
fi
297298
else
298-
MESSAGE+="No WLC/MWI info found for drive ${d} on ${1}. "
299+
MESSAGE+="No WLC/MWI/PLR info found for drive ${d} on ${1}. "
299300
EXITCODE=3
300301
PREFIX='UNKNOWN'
301302
fi

0 commit comments

Comments
 (0)