Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== smartmon ====== ^ Author | [[ michael.adelmann@gmail.com | mikadel ]] | ^ Compatibility | Xymon 4.3 | ^ Requirements | Linux, smartmontools | ^ Download | None | ^ Last Update | 2011-10-06 | ===== Description ===== In conjunction with the smartmontools package this script monitors the S.M.A.R.T. status of your hard drives on Linux. This also works if your hard drives are "hidden" behind a raid controller. Note: This currently only works for the first hard drive. {{:monitors:smart.png?400|}} ===== Installation ===== === Client side === Create the following files in your xymon client directory: monitoring script: <xymon-client-ext>/smart monitoring config: <xymon-client-etc>/smart.conf xymon monitor config: <xymon-client-etc>/clientlaunch.d/smart.cfg Find your RAID crontroller at http://sourceforge.net/apps/trac/smartmontools/wiki/Supported_RAID-Controllers and change CONTROLLER@smart.conf accordingly. Additionally you have to allow sudo for hobbit. Edit visudo and add this line: hobbit ALL=NOPASSWD:/usr/sbin/smartctl === Server side === None. ===== Source ===== ==== smart ==== <hidden onHidden="Show Code ⇲" onVisible="Hide Code ⇱"> <code> #!/bin/bash COLOR="clear" COLUMN="smart" CONFIG="${HOBBITCLIENTHOME}/etc/smart.conf" MSG="No S.M.A.R.T. device detected." RAID="" SMARTCTL="/usr/sbin/smartctl" SUDO="/usr/bin/sudo" # read config file source $CONFIG if [ -n "$CONTROLLER" ]; then RAID="-d $CONTROLLER,$COUNT" fi RESULT="Device:\n\t$DEVICE\n\nStatus:\n\n" TMP=`$SUDO $SMARTCTL /dev/$DEVICE $RAID --all -X` SMART=`echo "$TMP" | grep "Device supports SMART and is Enabled"` if [ -n "$SMART" ]; then MSG="$TMP" COLOR="green" RESULT="$RESULT\t&green Device supports SMART and is Enabled\n" STATUS=`echo "$TMP" | grep "SMART Health Status: OK"` if [ -z "$STATUS" ]; then COLOR="red" RESULT="$RESULT&red SMART Health Status not OK\n" else RESULT="$RESULT\t&green SMART Health Status: OK\n" fi SELF=`echo "$TMP" | grep "Self Test returned without error"` if [ -z "$SELF" ]; then COLOR="red" RESULT="$RESULT&red Self Test returned with error\n" else RESULT="$RESULT\t&green Self Test returned without error\n" fi fi MSG=`echo -e "\n$RESULT\n\n$MSG\n"` $BB $BBDISP "status $MACHINE.$COLUMN $COLOR `date` $MSG" </code> </hidden> ==== smart.cfg ==== <hidden onHidden="Show Code ⇲" onVisible="Hide Code ⇱"> <code> [smart] ENVFILE /etc/hobbit/hobbitclient.cfg CMD $HOBBITCLIENTHOME/ext/smart LOGFILE /var/log/hobbit/smart.log INTERVAL 5m </code> </hidden> ==== smart.conf ==== <hidden onHidden="Show Code ⇲" onVisible="Hide Code ⇱"> <code> # S.M.A.R.T. monitoring configuration CONTROLLER="cciss" COUNT=1 DEVICE="sda" </code> </hidden> ===== Known Bugs and Issues ===== This currently only works for the first hard drive. ===== To Do ===== Enable monitoring for all hard drives. ===== Credits ===== ===== Changelog ===== * **2011-10-06** * Initial release monitors/smart.txt Last modified: 2011/10/10 15:08by 127.0.0.1