Image Image Image Image Image Image Image Image Image Image

Ubuntu Server | June 7, 2020

Scroll to top

Top

No Comments

Monitorare la temperatura dei Hard Disk in Ubuntu

Monitorare la temperatura dei Hard Disk in Ubuntu
Francesco Gabriele

Ho creato uno scipt bash che trova ogni disco nel computer, e controlla la sua temperatura, ed in caso di temperatura alta manda una mail e dopo spegne il server.

Prima di tutto installiamo le utility necessarie:

apt-get install smartmontools

Ed ora lo script:

vim /script/monitor_temperatura.sh

#! /bin/bash
DISKS=”`blkid | grep sd | cut -c 1-8 | uniq`”
SMART=/usr/sbin/smartctl
ARGS=”-a -d ata”
LOG=/usr/bin/logger
DOWN=/sbin/shutdown
ALERT_LEVEL=55
for disk in $DISKS
do
if [ -b $disk ]; then
HDTEMP=$($SMART $ARGS $disk | grep -m 1 Temperature | awk ‘{print $10}’)
if [ $HDTEMP -ge $ALERT_LEVEL ]; then
$LOG “System going down as hard disk : $disk temperature $HDTEMP°C crossed its limit”
/bin/echo “System going down as hard disk : $disk temperature $HDTEMP°C crossed its limit” | mail -s “ServerKVM FrankHome” francesco.gabriele@gmail.com
sync;sync
$DOWN -h 0
fi
fi
done

Ora lo scheduliamo tramite cron:

*/50 * * * * /script/monitor_temperatura.sh

Ovviamente anche in questo caso dovrete settare i vari smtp (postfix,exim,ssmtp ecc..) per l’invio della mail.

Spero possa essere utile a molti

Frank

Submit a Comment

*

adidas yeezy 650 boost adidas yeezy boost 650 adidas yeezy 650 boost colorways adidas yeezy 650 350 2 0 boost yeezy boost 650 adidas yeezy boost 650 supreme x nike air uptempo release info adidas yeezy boost 650 v1 sample detailed look adidas yeezy boost 650 v1 sample adidas yeezy boost 650 v1 sample adidas yeezy boost 650 v1 adidas yeezy 650 boost adidas yeezy boost 650 adidas yeezy 650 boost colorways adidas yeezy 650 350 2 0 boost yeezy boost 650 adidas yeezy boost 650 supreme x nike air uptempo release info adidas yeezy boost 650 v1 sample detailed look adidas yeezy boost 650 v1 sample