forked from jedda/OSX-Monitoring-Tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_smart.sh
More file actions
executable file
·30 lines (22 loc) · 930 Bytes
/
check_smart.sh
File metadata and controls
executable file
·30 lines (22 loc) · 930 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash
# Check SMART - nagios wrapper for smartmontools
# by Jedda Wignall
# http://jedda.me
# v1.0 - 20 Feb 2012
# Initial release.
# Super simple wrapper script that uses the fantastic smartmontools to report on SMART status of drives.
# Takes one arguments (disk ident) and users:
# ./check_od_auth.sh diradmin password
# Make sure to point to your smartctl location if it is not in the same spot as mine.
# We use this on almost all our monitored Macs for the obvious reasons. It has saved us from headaches more than a few times by getting on top of a dying drive in time.
# enable SMART on the drive if it is not already
smartoncmd=`/opt/local/libexec/nagios/smartctl --smart=on $1`
# run smartctl on disk and report on output
if echo `/opt/local/libexec/nagios/smartctl -H $1` | grep -q "PASSED"
then
printf "OK - SMART Passed\n"
exit 0
else
printf "WARNING - SMART FAILURE!\n"
exit 1
fi