気温がっ


なんかサーバ室の前が暑いなと思って中を覗くと、エアコンが止まってました。
やべーと思ってあわててエアコンを再起動したけれども、肝が冷えましたよ、ええ。
早く気づけるようにSNMPの温度計が欲しいなぁ、とおもうけれども、でかいマシンにしか温度計は付いていなくて、AT互換機のmotherのセンサもあれなんで、とりあえず落ち着くまでS.M.A.R.Tでdiskの温度を測ることにした。
いろいろ触っているFreeBSDマシンのdiskの温度をとりあえず監視ということで、
/usr/ports/sysutils/smartmontools/のportをinstall
# smartctl -a ad0 | grep -i temp
とすると、温度が出てきました。
ちょっとずつ下がっているのが見えてうれしい。
あとはperlで処理して、温度をmailするようにします。


というわけで書きました。
5年ぶりくらいのperlなんで見苦しいのは勘弁。

# HDD Temp. monitoring script. Using smartctl
# (c)2004 Yoshihiro TSUBOI
$str = qx "smartctl -a ad0 | grep -i temp";
chomp $str;
$str = substr($str, 87, 2);
if ($str >= 27) {
$from = "ほげほげ";
$to = "ほげほげ";
open MAIL, "| /usr/sbin/sendmail -f $from -t $to";
print MAIL "From: $from\n";
print MAIL "Subject: Temp. Alert!!\n";
print MAIL "To: $to\n";
print MAIL "HDD temp is going up!\n";
print MAIL "Current temp. is $str degree.\n";
print MAIL "Please check NOC!\n";
close MAIL;
}

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>