Glen Pitt-Pladdy :: BlogLM 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. SensorsMost 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 SNMPFortunately 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 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 TemplatesI 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 ShotsUpdate: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( |
|||
Disclaimer: This is a load of random thoughts, ideas and other nonsense and is not intended to be taken seriously. I have no idea what I am doing with most of this so if you are stupid and naive enough to believe any of it, it is your own fault and you can live with the consequences. More importantly this blog may contain substances such as humor which have not yet been approved for human (or machine) consumption and could seriously damage your health if taken seriously. If you still feel the need to litigate (or whatever other legal nonsense people have dreamed up now), then please address all complaints and other stupidity to yourself as you clearly "don't get it".
Copyright Glen Pitt-Pladdy 2008-2023
|
Comments:
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
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
.....
.....
coretemp-isa-0000
Adapter: ISA adapter
Core 0 Temp: +35.0°C (high = +74.0°C, crit = +100.0°C)
coretemp-isa-0001
Adapter: ISA adapter
Core 1 Temp: +30.0°C (high = +74.0°C, crit = +100.0°C)
coretemp-isa-0002
Adapter: ISA adapter
Core 2 Temp: +42.0°C (high = +74.0°C, crit = +100.0°C)
coretemp-isa-0003
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