Atom Feed
Comments Atom Feed

Similar Articles

2015-01-08 22:58
Nginx on Cacti via SNMP
2015-01-08 22:59
php-fpm on Cacti via SNMP
2015-02-13 22:51
opendkim on Cacti via SNMP
2010-03-20 21:52
apcupsd stats on Cacti (via SNMP)
2015-05-14 22:35
PHP APC on Cacti via SNMP

Recent Articles

2019-07-28 16:35
git http with Nginx via Flask wsgi application (git4nginx)
2018-05-15 16:48
Raspberry Pi Camera, IR Lights and more
2017-04-23 14:21
Raspberry Pi SD Card Test
2017-04-07 10:54
DNS Firewall (blackhole malicious, like Pi-hole) with bind9
2017-03-28 13:07
Kubernetes to learn Part 4

Glen Pitt-Pladdy :: Blog

LM Sensors stats on Cacti (via SNMP)

Following on from the basics of SNMP I did previously, this article now adds the next set of SNMP extension scripts, config, and Cacti templates to monitor LM Sensors data from Motherboard Sensors.


Most PC Motherboards these days contain an array of sensors and data captured from the system. This may include Motherboard Voltages, Temperatures, Fan speeds among other things.

The Linux package "lmsensors" provides tools to interrogate many popular Motherboard sensors chips and extract useful data from them. This article can't cover the particular setup required for your Motherboard sensor chip. There is plenty of docs and example config around to help you get the LM Sensors package configured.

Where we need to get to for this article is being able to execute the "sensors" command as a regular user and getting back a load of correct data from different sensors on the Motherboard.

Sensors over SNMP

Fortunately as sensors are available to unprivileged users the acrobatics discussed previously are not needed to get this data into snmpd. A bunch of extension scripts and some config is all that is needed.

I have made all my sensor scripts for the Motherboard I monitor available below. As each Motherboard is different and provides different sensors, you will need to adapt these scripts to your particular motherboard. They are basically shell scripts that use grep, and sed to extract the parameters we want from the "sensors" command.

Downloads: LM Sensors Cacti Monitoring Template and Scripts on GitHub

I place these sensors-* scripts (make it executable first: chmod +x sensors-*) in /etc/snmp

As mentioned, you will need to adapt the scripts for the output of your sensors chips and config.

In /etc/snmp/snmpd.conf add the following lines:

extend sensortemps /etc/snmp/sensors-temps
extend sensorfans /etc/snmp/sensors-fans
extend sensorvoltages /etc/snmp/sensors-voltages

Many Motherboards provide other parameters which you could also monitor by adapting these scripts.

Once you have added all this in you can test these by running the scripts from the command line, and via SNMP by appending the appropriate SNMP OID to the "snmpwalk" commands shown previously.

Cacti Templates

I have generated some basic Cacti Templates for my sensors outputs. You will have to adapt these Graph Templates and the corresponding Data Source Templates to match your sensors outputs.

Simply import the template cacti_host_template_lm_sensors_parameters.xml, modify them as needed, and add the graphs you want to the appropriate device graphs in Cacti. It should just work if your SNMP is working correctly for that device (ensure other SNMP parameters are working for that device).

Graph Screen Shots

LM Sensors over SNMP on Cacti : Temperatures

LM Sensors over SNMP on Cacti : Fan Speeds

LM Sensors over SNMP on Cacti : Motherboard Voltages


One person had pointed out that there has been some problems on some versions of Cacti with importing the templates. The template was generated with version 0.8.7b (from Debain Lenny).

The problem manifests it's self as "Cacti version does not exist" error, and appears to be cured by adding in this version, although in my version the file is actually global_arrays.php

The relevant array from my global_arrays.php / config_array.php:

$hash_version_codes = array(
    "0.8.4"  => "0000",
    "0.8.5"  => "0001",
    "0.8.5a" => "0002",
    "0.8.6"  => "0003",
    "0.8.6a" => "0004",
    "0.8.6b" => "0005",
    "0.8.6c" => "0006",
    "0.8.6d" => "0007",
    "0.8.6e" => "0008",
    "0.8.6f" => "0009",
    "0.8.6g" => "0010",
    "0.8.6h" => "0011",
    "0.8.6i" => "0012",
    "0.8.6j" => "0013",
    "0.8.7"  => "0014",
    "0.8.7a" => "0015",
    "0.8.7b" => "0016",
    "0.8.7c" => "0017",
    "0.8.7d" => "0018",
    "0.8.7e" => "0019",
    "0.8.7f" => "0020",
    "0.8.7g" => "0021"


Stefano Image  2010-07-10 21:34 :: Stefano

Hi, great works! Your template works like a charm! Thanks for sharing it.
I'd like to know if there is a simple way to implement CPU temperature of a multi-core CPU... can you help me to find a way?
Thanks a lot.

Glen Pitt-Pladdy Image  2010-07-11 07:21 :: Glen Pitt-Pladdy

Hi Stefano

I don't see why the existing scripts and templates can't be adapted to doing individual cores of a processor. All you will need is to make sure that "sensors" outputs the data - in my case making sure the "coretemp" module is loaded so sensors outputs:

$ sensors
Adapter: ISA adapter

Adapter: ISA adapter
Core 0 Temp:      +35.0°C  (high = +74.0°C, crit = +100.0°C)

Adapter: ISA adapter
Core 1 Temp:      +30.0°C  (high = +74.0°C, crit = +100.0°C)

Adapter: ISA adapter
Core 2 Temp:      +42.0°C  (high = +74.0°C, crit = +100.0°C)

Adapter: ISA adapter
Core 3 Temp:      +33.0°C  (high = +74.0°C, crit = +100.0°C)

Then alter the temperatures script with more 'Core X Temp:' lines, add the corresponding data templates (clone the existing ones), and add the traces to the temperature template.

Hope that answers your question

Note: Identity details will be stored in a cookie. Posts may not appear immediately