21

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?

7 Answers 7

22
+75

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

2
7

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).

4

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.

1
  • 3
    requirement of installing MySQL limits its use cases Aug 12, 2016 at 19:52
3

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.

2

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.

1

check this link: https://launchpad.net/indicator-sysmonitor

im1

(from OMG Ubuntu)

Installation:

sudo add-apt-repository ppa:alexeftimie/ppa
sudo apt-get update && sudo apt-get install indicator-sysmonitor

Remark: only works in Natty/11.04

2
  • 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
    – Jiew Meng
    May 11, 2011 at 14:33
  • @jiewmeng I edited in an image and installation method
    – Rinzwind
    May 29, 2011 at 12:57
1

I've been using pandora fms to monitor about 40 servers and 100 computer systems at my company as well as its webpage. You may find it usefull installing a software agent at your server and setting local modules to monitor what you need. If you'd like to try it here you can visit the webpage of pandora: Panndora FMS Unified Monitoring Tool

Regards

Ivo Yordanov

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .