Documents
Howtos — CPU and HD Temperature
This document describes the procedure on how to install and configure CPU an HD temperature monitoring system. Data yield from lm_sensors and hddtemp are forwarded to rrdtool for the processing of statiscal graph.OS used: Linux (Fedora 9); tools used: lm_sensors, hddtemp, rrdtool, rrdtool-perl, and perl
Prepare perl, rrdtool, and rrdtool-perl
-
Get and install Perl, rrdtool, rrdtool-perl:
[1] Download above packages at http://download.fedora.redhat.com/pub/fedora/linux/releases/9/Fedora/x86_64/os/Packages, and install it by executing:
# rpm -ivh perl-x.x.x.rpm rrdtool-x.x.x.rpm rrdtool-perl-x.x.x.rpm; or
[2] If Fedora 9 DVD is present, install the package by executing these:
# mount /dev/cdrom /mnt
# rpm -ivh /mnt/Packages/perl-x.x.x.rpm
# rpm -ivh /mnt/Packages/rrdtool-x.x.x.rpm
# rpm -ivh /mnt/Packages/rrdtool-perl-x.x.x.rpm; or
[3] If internet is availble, do the easy way by executing this:
# yum install perl rrdtool rrdtool-perl.
Prepare lm_sensors
Please note that Fedora 9 comes with pre-installed lm_sensors.-
Get and install lm_sensors:
[1] Download the package at http://download.fedora.redhat.com/pub/fedora/linux/releases/9/Fedora/x86_64/os/Packages, and install it by executing:
# rpm -ivh lm_sensors-x.x.x.rpm; or
[2] If Fedora 9 DVD is present, install the package by executing these:
# mount /dev/cdrom /mnt
# rpm -ivh /mnt/Packages/lm_sensors-x.x.x.rpm; or
[3] If internet is available, do the easy way by executing this:
# yum install lm_sensors. -
Create /etc/sysconfig/lm_sensors by executing this:
# /usr/sbin/sensors-detect
Just follow on-screen instructions. -
Permamently include lm_sensors during boot-up sequence by executing these:
# /sbin/chkconfig --add lm_sensors
# /sbin/chkconfig --level 12345 httpd off
# /sbin/chkconfig --level 3 httpd on
Prepare hddtemp
-
Get and install hddtemp:
[1] Download the package at http://download.fedora.redhat.com/pub/fedora/linux/releases/9/Fedora/x86_64/os/Packages, and install it by executing:
# rpm -ivh hddtemp-x.x.x.rpm; or
[2] If Fedora 9 DVD is present, install the package by executing these:
# mount /dev/cdrom /mnt
# rpm -ivh /mnt/Packages/hddtemp-x.x.x.rpm; or
[3] If internet is availble, do the easy way by executing this:
# yum install hddtemp.
Create scripts
- Create /etc/rrdtool directory to store the scripts.
-
Create /etc/rrdtool/cpu to extract CPU temperature. For /usr/bin/sensors that displays these lines:
lm85-i2c-0-2c
Adapter: SMBus I801 adapter at 0400
...
CPU Temp: -128°C (low = +0°C, high = +65°C) FAULT
...
lm85-i2c-0-2e
Adapter: SMBus I801 adapter at 0400
CPU Temp: +40°C (low = +0°C, high = +88°C)
...
the following command is used:
sensors | grep 'CPU Temp:' | awk '{print $3}' | sed -e 's/+//' -e 's/[^0-9+\.].*//' -e '1,1d' - Create /etc/rrdtool/cputemp.pl script to create an RRD graph for the CPU temperature.
- Create /etc/rrdtool/hddtemp.pl script to create an RRD graph for the HDD temperature.
Initiate scripts every 5 minutes
-
Edit /etc/crontab and add these lines:
*/5 * * * * root /etc/rrdtool/hddtemp.pl > /dev/null
*/5 * * * * root /etc/rrdtool/cputemp.pl > /dev/null
-
Restart crond by executing this command:
# /etc/rc.d/init.d/crond restart