Menu
Index

Contact
LinkedIn
GitHub
Atom Feed
Comments Atom Feed



Tweet

Similar Articles

13/02/2015 22:51
opendkim on Cacti via SNMP
14/05/2015 22:35
PHP APC on Cacti via SNMP
22/11/2009 16:49
Postfix stats on Cacti (via SNMP)
14/11/2009 13:46
Apache stats on Cacti (via SNMP)
31/10/2009 14:46
SMART stats on Cacti (via SNMP)
08/01/2015 22:58
Nginx on Cacti via SNMP

Recent Articles

21/03/2017 15:18
Kubernetes to learn Part 2
21/03/2017 13:53
Kubernetes to learn Part 1
17/07/2016 15:23
AWS ssh known_host sync
11/07/2016 08:42
File integrity and log anomaly auditing Updated (like fcheck/logcheck)
30/05/2016 13:09
Xenial LXC Container on Debian

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.

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

Update:

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"
    );

Comments:

Stefano Image  10/07/2010 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.
Stefano

Glen Pitt-Pladdy Image  11/07/2010 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
it8716-isa-0290
Adapter: ISA adapter
.....
.....

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




Are you human? (reduces spam)
Note: Identity details will be stored in a cookie. Posts may not appear immediately