Lm sensors
From TrustixWiki
this page needs a makeover!
lm_sensors is now in contrib:
swup --install lm_sensors
Synopsis: Install lm_sensors to read the sensors built into the motherboard on your server The official lm_sensors home page is at http://secure.netroedge.com/~lm78/
Overview
I want to build an RPM package to make all this easy but first I need to build from scratch. Here are my notes. Not for the faint of heart Install development and kernel sources The i2c package creates a loadable kernel module i2c that will talk to the hardware. To build i2c you have to first build the kernel modules from source; you don't have to INSTALL the kernel modules, but the source tree has to be around. Therefore you need to have the kernel sources (TSL package kernel-source) installed and the various development packages installed (bison, flex, gcc, linux-headers, glibc-devel). Since I intend to put together an rpm soon I will not detail these steps. Yes, there are i2c modules included with the Trustix kernel. They won't work with lm_sensors so you can't use them. For a given lm_sensors you have to have the matching i2c package installed. Download i2c and lm_sensors tarballs (and patch) from Netroedge NOTE on VERSION I used version 2.8.8, the last of the 2.8 series. 2.9.0 would not build on my TSL development system. You can get the appropriate files from http://secure.netroedge.com/~lm78/archive/ Unpack tarballs
tar xzf i2c-2.8.8.tar.gz tar xzf lm_sensors-2.8.8.tar.gz
Build i2c and lm_sensors Generally speaking, follow the instructions in the lm_sensors QUICKSTART document to build and install. Some notes specific to TSL 2.2: You have to add -fno-stack-protector to CFLAGS in the Makefiles for both i2c amd lm_sensors. Otherwise you will get UNRESOLVED REFERENCES errors when attempting to load the kernel modules. When building i2c, if you get about 5000 error and warning messages it's because you didn't build kernel modules. Build them then try again. When building lm_sensors. did you remember to install bison and flex packages? If not do that then do a 'make clean' and try 'make' again. Test the modules Take your server offline for this step. There are many motherboards out there. You have to test lm_sensors to get it going on your hardware. This is a sensitive operation and can lock up your server. The program sensors-detect (in prog/detect/ in the lm_sensors source tree) will load modules and use them to examine your system. When it completes it will tell you what entries to make in /etc/modules.conf and what lines to add to your startup scripts. Here are the results for my old Intel SE440-BX2 Pentium III motherboard. To make the sensors modules behave correctly, add these lines to /etc/modules.conf:
#----cut here---- # I2C module options alias char-major-89 i2c-dev #----cut here----
You can say "yes" when it asks if you want it to create /etc/sysconfig/lm_sensors and then you can install the startup file
cp prog/init/lm_sensors.init /etc/init.d/lm_sensors chkconfig lm_sensors on service lm_sensors start
Reading sensor output Run the 'sensor' program to read output from your system's sensors. Here is what my SE440-BX2 output looks like:
# sensors adm9240-i2c-0-2d Adapter: SMBus PIIX4 adapter at 7000 2.5V: +1.51 V (min = +0.00 V, max = +0.00 V) ALARM Vccp1: +2.05 V (min = +0.00 V, max = +0.00 V) ALARM 3.3V: +3.36 V (min = +0.00 V, max = +0.00 V) ALARM 5V: +5.20 V (min = +0.00 V, max = +0.00 V) ALARM 12V: +12.00 V (min = +0.00 V, max = +0.00 V) ALARM Vccp2: +2.60 V (min = +0.00 V, max = +0.00 V) ALARM fan1: 0 RPM (min = -1 RPM, div = 2) ALARM fan2: 0 RPM (min = -1 RPM, div = 2) ALARM temp: +23.5 C (high = -128 C, hyst = -128 C) ALARM vid: +2.00 V alarms: Chassis intrusion detection ALARM eeprom-i2c-0-50 Adapter: SMBus PIIX4 adapter at 7000 Memory type: SDR SDRAM DIMM Memory size (MB): 256 eeprom-i2c-0-51 Adapter: SMBus PIIX4 adapter at 7000 Memory type: SDR SDRAM DIMM Memory size (MB): 128
You can make all those frightening "ALARM" messages go away by adding a proper configuration file. Read the sensors.conf man page.
What's next?? Now, you have a way to take readings from your sensors. Next, you will want to log data and display it. You can do this with rrd tool.
Who to blame this mess? This page was originally contributed by Brian Wilson