Rabu, 14 Januari 2009

Tip of the Day: Use lm-sensors to Monitor Your Hardware

sensors is a tool which will output the temperatures read from all your chip sensors. To get this utility, you will have to install the lm-sensors package. In Debian Lenny, issue the following command as root:

apt-get install lm-sensors

This package contains the sensors tool, which if ran will output voltages and temperatures for your CPU, graphics card, and so on.

Next, we will make a simple script which will trigger sensors every five seconds, so you will be able to monitor your system in different load times:

#!/bin/bash

i=0
while [[ 1 -eq 1 ]]; do
clear
echo "Running sensors..."
echo -e "Elapsed time: $i seconds\n"
sensors
echo "Use ^C (CTRL+C) to stop"
sleep 5
i=$(( $i + 5 ))
done

This script will run the sensors utility every five seconds. You can save it under a suggestive name,
say cputemp.sh, make it executable (chmod 755 cputemp.sh) and put it in a directory in your path
(e.g. ~/bin/, where ~ is your home directory).

Tidak ada komentar:

Posting Komentar