Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata
sudo apt-get update
sudo apt-get install -y smartmontools --no-install-recommends
sudo visudo && sudo service sudo restart
xymon   ALL=(ALL) NOPASSWD:ALL
sudo nano /usr/lib/xymon/client/ext/smart_disk_check.sh
#!/bin/sh

COLUMN=smart                            # THIS IS WHERE XYMON GETS COLUMN NAME
COLOR=green                             # By default, everything is OK
MSG="smartctl -H /dev/sd# | grep PASSED" # The comamnd from var

#In this test, if var = empty = RED
#Depends on Smart Version! If its OK or PASSED
#var="$(sudo smartctl -H /dev/sda | grep 'SMART Health Status: OK')"
var="$(sudo smartctl -H /dev/sda | grep PASSED)"
var1="$(sudo smartctl -H /dev/sdb | grep PASSED)"
cmd="$(sudo smartctl -a /dev/sda ; sudo smartctl -a /dev/sdb)"

if [ -z "$var" ] || [ -z "$var1" ]

then

COLOR=red
MSG="${MSG}
FAILED
"${cmd}"
"
else

MSG="${MSG}
SUCCESS
"${cmd}"
"
fi

# Leave the rest of script alone
# Tell Xymon about it
$XYMON $XYMSRV "status $MACHINE.$COLUMN $COLOR `date`

${MSG}
"

exit 0
sudo chown xymon:xymon /usr/lib/xymon/client/ext/smart_disk_check.sh
sudo chmod 777 /usr/lib/xymon/client/ext/smart_disk_check.sh
sudo nano /etc/xymon/clientlaunch.d/smart_disk_check.cfg
[smart_disk_check]
	ENVFILE $XYMONCLIENTHOME/etc/xymonclient.cfg
	CMD $XYMONCLIENTHOME/ext/smart_disk_check.sh
	LOGFILE $XYMONCLIENTHOME/logs/smart_disk_check.log
	INTERVAL 5m
/usr/lib/xymon/client/bin/xymoncmd /usr/lib/xymon/client/ext/smart_disk_check.sh

Restart Service :

sudo service xymon-client restart

On Server :

sudo service xymon restart && sudo service apache2 restart
  • No labels