How to monitor & log server hardware temperatures & load

52,894

Solution 1

If you want something that does not depend on a desktop:

Have a look at lm-sensors Install lm-sensors. From the description:

Lm-sensors is a hardware health monitoring package for Linux. It allows 
you to access information from temperature, voltage, and fan speed 
sensors. It works with most newer systems.

This package contains programs to help you set up and read data from
lm-sensors.

From their project page (2016 edit: project is dead. Our own wiki has some info):

  • Unattended high-end server, router or other mission-critical machine automated monitoring. Easily create a cron job to query the status of your hardware and email you in the event of a problem before it becomes critical. That way, you can be alerted within seconds of a failing critical component such as a power supply, fan, other cooling mechanism, or even detect if the case has been opened.
  • Embedded systems running Linux. These can use this package to monitor voltages, temperatures, fan speeds, etc. using off-the-shelf components and utilizing a range of bus interfaces (e.g. ISA, SMBus, I2C or SPI).
  • More generally, data acquisition. Easily measure various types of data (rotational speeds, voltages, temperatures, etc.) using cheap off-the-shelf parts. Very useful for systems automation (in the home, workshop, weather station, you name it).

lm-sensors has a daemon, called sensord, that uses RRDtool for 'data logging and graphing system for time series data'. So it includes graphics like this that can be shown through a webserver:

im1

(taken from lm-sensors project page).

To install the sensord daemon you will likely have to install the sensord package.

Example from my notebook:

im2

The config file for this is located at /etc/sensors3.conf

lm-sensors is sort of the basic of any temperature measuring. Desktop items are more than likely to get their information from this package. An example If you want something that depends on a desktop

psensor.

  • motherboard and CPU sensors (requires lm-sensors to be installed).
  • NVidia GPUs
  • Hard Disk Drives (requires hddtemp to be installed).
  • Fan speed (again, requires lm-sensors to be installed).

Installation by adding a PPA:
sudo add-apt-repository ppa:jfi/ppa
sudo apt-get update && sudo apt-get install psensor

(Oneiric will have psensor included)

(old) example from ubuntugeek.com: im6

Solution 2

If programs like Cacti are too much then you could use a script which just logs to text file by day - run it with crontab. You need to have lm-sensors installed.

#!/bin/bash
_now=$(date +"%Y_%m_%d")
_file="temp_log_$_now.txt"
(date; sensors; echo '-----------') | cat >> "/var/log/temperatures/$_file"

This only works if there is a directory /var/log/temperatures which may need to be created first (sudo mkdir /var/log/temperatures) and which only root can write to (so you would need to use the root crontab. If you want to use the per user crontab you could instead create /home/user/temperatures (mkdir ~/temperatures) and use that path in the script (use the full path in the script).

Solution 3

For logging of cpu/ram/temperatures/traffic on a server, I recommended Cacti. It is advertised as a 'complete frontend for RRDtool', and can have multipled data sources such as lm-sensors, SNMP or even custom scripts. Data is stored in RRD, and used to create daily, weekly, monthly and yearly graphs.

See the Cacti website for more details, screenshots and links to live example sites. It can be tricky to set up the very first time, but is worth it in the end.

Solution 4

I use zenoss to monitor about 70 unix and windows servers at my office. We also monitor all networking equipment, and even a thermostat in the Server room. Most of it is via SNMP. (however, we use some custom written scripts to monitor some application performance)

Most servers (such as dell and hp) have internal temperature sensors, that you can query using SNMP. You can also monitor processes, CPU utilization, network throughput, etc. I get alerts if servers go offline, or start using too much CPU, or if critical processes go down.

Seriously, I can't urge enough to look at things like zenoss, hyperic, and nagios! the free versions can monitor multiple systems, but they can also just monitor one. They help with troubleshooting, and finding out what a server was doing at 2am when a problem happened.

Solution 5

Check the package munin, it can monitor almost everything.

https://help.ubuntu.com/lts/serverguide/munin.html https://wiki.ubuntuusers.de/munin

sudo apt-get install apache2
sudo apt-get install munin-node`
sudo systemctl enable munin-node
sudo a2enconf munin

Check access permission in /etc/apache2/conf-enabled/munin.conf looking like this:

<Directory /var/cache/munin/www>
    Require all granted
    AllowOverride None
    Order Allow,Deny
    Allow from all
    Options None
</Directory>

<Location /munin-cgi/munin-cgi-graph>
    Require all granted
    <IfModule mod_fcgid.c>
        SetHandler fcgid-script
    </IfModule>
    <IfModule !mod_fcgid.c>
        SetHandler cgi-script
    </IfModule>
</Location>

Restart apache2:

sudo apache2ctl restart

Fire your browser to: http://localhost/munin - enjoy.

Look into /etc/munin for further options.

Share:
52,894

Related videos on Youtube

Jiew Meng
Author by

Jiew Meng

Web Developer &amp; Computer Science Student Tools of Trade: PHP, Symfony MVC, Doctrine ORM, HTML, CSS, jQuery/JS Looking at Python/Google App Engine, C#/WPF/Entity Framework I hope to develop usable web applications like Wunderlist, SpringPad in the future

Updated on September 18, 2022

Comments

  • Jiew Meng
    Jiew Meng over 1 year

    I am looking for a way to log & monitor my server hardware temperatures and load (like for CPU or RAM). How might I do that?

    Objective is to:

    • ensure hardware is not heating up
    • identify what should be upgraded & what is in excess (like perhaps to learn maybe not to get such a good CPU for example)

    Ok I can use one of the applets that live in the task bar but what about logging?

  • Jiew Meng
    Jiew Meng almost 13 years
    this maybe a very stupid question but how do I install that? I tried sudo add-apt-repository 'deb http://ppa.launchpad.net/alexeftimie/ppa/ubuntu natty main' & sudo apt-get install indicator-sysmonitor then Unable to locate package indicator-sysmonitor
  • Rinzwind
    Rinzwind almost 13 years
    @jiewmeng I edited in an image and installation method
  • user121330
    user121330 over 8 years
    Looks like a great answer. Seems like images and links are broken. :-/
  • Rinzwind
    Rinzwind over 8 years
    That image is just the installer icon ;-) See meta.askubuntu.com/a/1853/15811 on what to do (anyone can change it to hostmar.co/software-small or hostmar.co/software-large ). But the project itself is dead .... pity :*(
  • Scott Stensland
    Scott Stensland over 7 years
    requirement of installing MySQL limits its use cases