#!/usr/bin/perl -w # # Original Version # ---------------- # http://www.Linux-1U.net/LCD/scripts/fan_detect.pl # # # fan_detect.pl -- detect when the fan fails w/ lm_sensors # ------------------------------------------ # http://www.Linux-1U.net/LCD/lm_sensors.Txt/i2c_*.txt -- howto install lm_sensors # # # -------------------------------------- # To see the CPU fan speeds and CPU temp ( for Asus Tusi-630TX ) # -------------------------------------- # cat /proc/sys/dev/sensors/it87-isa-0290/{fan1,fan2,fan3} # cat /proc/sys/dev/sensors/it87-isa-0290/{temp1,temp2,temp3} # # # # # # run this script from cron -- check the fan and cpu temps every 5 minutes # # # root# crontab -e # # # # # monitor the fans every 5-minutes via cron # # 0,5,10,15,20,25,30,35,40,45,50,55 * * * * /usr/local/scripts/fan_detect.pl # # # # my ( $NM ) = "fan_detect.pl"; # my ( $Host ) = `hostname -f` ; chomp ( $Host ); # my ( $Time ) = `date `; chomp ( $Time ); # # # Where to send email when the fan dies # ------------------------------------- # my ( $Email ) = "you\@${Host}"; # Change to your email address # # ========================================================= # # if ( ! -d "/proc/sys/dev/sensors/it87-isa-0290" ) { printf "ERROR: lm_sensors not properly installed on tusi-630tx..\n"; exit 1; } # my ( $huh, $fanspeed ) = split ( /\s+/, `cat /proc/sys/dev/sensors/it87-isa-0290/fan1` ); # # if ( $fanspeed == 0 ) { # printf "mail -s '$NM: EMERGENCY - cpu fan died at $Time on $Host' $Email ..\n"; # ` mail -s "$NM: EMERGENCY - cpu fan died at $Time on $Host" $Email < /dev/null ` ; # # # -------------------------------- # stop the machine if you prefer # -------------------------------- # # halt ; # } # fan died # # end of script