[CentOS] OT: simple server room temp monitor

Mon Jan 9 05:30:17 UTC 2012
Fajar Priyanto <fajarpri at arinet.org>

Hi all,
I have a spare USB GSM modem and it's card.
I want to setup a very simple server room temperature monitor using it.

Anyone has experience to share?
- Program required
- Script example

Currently I have something like this that will send email if temp
reaches something. Invoked by cron.
#!/bin/bash
# lm_sensors must be installed and configured first
# This will check the CPU temp and send email
# Changelog:
# 18 Feb 2009 - created

temp=$(/sbin/service lm_sensors status | /bin/grep CPU | /bin/cut -c 15-16)
/bin/echo $temp

#function to send mail with subject "Hot"
func_mail_hot () {
/bin/echo $temp | /bin/mail -s "server is hot" notification at arinet.org
}

#function to send mail with subject "Cool"
func_mail_cool () {
/bin/date >> /var/log/temp.log
/bin/echo $temp >> /var/log/temp.log
}

#testing the temperature of CPU
((temp>40)) && func_mail_hot || func_mail_cool


Thank you
-- 
Fajar.