23 lines
408 B
Bash
Executable File
23 lines
408 B
Bash
Executable File
#!/bin/bash
|
|
# Checks status of disks SMART
|
|
|
|
STATUS_LABEL="SMART Health Status:"
|
|
STATUS_OK="$STATUS_LABEL OK"
|
|
|
|
if [[ "$#" == "0" ]]; then
|
|
echo "Usage: $0 <disk1> [<disk2> ... <diskX>]"
|
|
exit
|
|
fi
|
|
|
|
for DISK in "$@"
|
|
do
|
|
STATUS=$(sudo /usr/sbin/smartctl -H -d scsi "$DISK" | grep "$STATUS_LABEL")
|
|
|
|
if [ "$STATUS" != "$STATUS_OK" ]; then
|
|
echo "CRITICAL: $DISK: $STATUS"
|
|
exit 2
|
|
fi
|
|
done
|
|
|
|
echo "OK: $STATUS_OK"
|