Net-SNMP lm_sensors temperature, fan speed, voltage monitor

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

sf_alpha
Posts: 9
Joined: Fri Jul 01, 2005 10:36 am

Net-SNMP lm_sensors temperature, fan speed, voltage monitor

Post by sf_alpha »

I have made template for monitor Temperature, Fan Speed and Voltages with SNMP on lm_sensors enabled Net-SNMP host.

- You may need to customize graph templates and other things suit to your system (and also colors you need).

- You may need to edit sensors.conf of lm_sensors and restart snmpd for change your sensor name from temp1, temp2, fan1, fan2 to CPU Temp, Chassis Fan, etc. (Try see output of 'sensors' command for get chip name and edit /etc/sensors.conf.

Add something like

Code: Select all

label temp1 "CPU Temp"
label temp2 "Board Temp"

label fan1 "CPU Fan"
After

Code: Select all

chip "CHIPNAME-*"
of your sensors chip.

It works for me(TM) for my cacti-0.8.6e on Gentoo

Cheers !

---

You can download templates here and import to your cacti
(use only lm_sensors, TCP connection statistics also work well :)

http://sf-alpha.bjgang.org/downloads/cacti/templates/

Download and put xml files under $CACTI/resources/snmp_queries
(use only lm_sensors)

http://sf-alpha.bjgang.org/downloads/cacti/queries/

---

This script just plot individual Temperature, Fan Speed and Temperature graph on each graph. If you want to graph them all in the one page like
http://forums.cacti.net/viewtopic.php?t ... ht=netsnmp

You can create your own Graph Templates suit to your needs or use
script there (which may not usable on some systems, My DELL system have 7 Fans !!! 4 Temperature Sensors !!! Which not in order and you need to add it yourself with that script)
Last edited by sf_alpha on Tue Mar 28, 2006 5:40 am, edited 3 times in total.
NightMonkey
Posts: 4
Joined: Thu Jul 14, 2005 10:14 pm

Post by NightMonkey »

Hello. I'm keen to use your templates and scripts, but my Cacti 0.8.6f doesn't seem to like them. I get "Error: XML parse error." on import. Any ideas? Did you export these scripts using Cacti's "Export Template" function, and what version did you export from?

Let me know if you need more information. Thanks.
RattleSn@ke
Posts: 17
Joined: Tue Aug 10, 2004 5:44 pm

Retreive problem

Post by RattleSn@ke »

Hai sf_alpha,

I did everything you said on the remote server which is running FC2.
But when I do a manual snmpwalk I get this:

Code: Select all

snmpwalk -v 2c -c public localhost .1.3.6.1.4.1.2021.13.16.2.1.1
UCD-SNMP-MIB::ucdExperimental.16.2.1.1 = No more variables left in this MIB View (It is past the end of the MIB tree)
And when I let cacti run the Dataquery I get this debug info:

Code: Select all

Data Query Debug Information 
 
+ Running data query [16].
+ Found type = '3' [snmp query].
+ Found data query XML file at '/www/cacti/resource/snmp_queries/net-snmp_lm_sensors_temp.xml'
+ XML file parsed ok.
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.2021.13.16.2.1.1'
+ No SNMP data returned
+ Found data query XML file at '/www/cacti/resource/snmp_queries/net-snmp_lm_sensors_temp.xml'
+ Found data query XML file at '/www/cacti/resource/snmp_queries/net-snmp_lm_sensors_temp.xml'
+ Found data query XML file at '/www/cacti/resource/snmp_queries/net-snmp_lm_sensors_temp.xml' 
Can you please help?? Did I forgot to configure something on the remote host?!?!
lucky
Cacti User
Posts: 62
Joined: Mon Sep 30, 2002 3:23 am
Location: Germany

Post by lucky »

hi.

i had the same problem... i had to build net-snmp with lm_sensors flag!
sf_alpha
Posts: 9
Joined: Fri Jul 01, 2005 10:36 am

Post by sf_alpha »

You need net-snmp with lm-sensors compiled in. I test import script on other server and it works. ... I will try to use from this forum again.


If I can, I will post how to compile net-snmp with lm-sensors later... But with gentoo you need only

USE="lm_sensors" emerge net-snmp
RattleSn@ke
Posts: 17
Joined: Tue Aug 10, 2004 5:44 pm

Post by RattleSn@ke »

lucky wrote:hi.

i had the same problem... i had to build net-snmp with lm_sensors flag!
Ok!
But when I try to configure with the following command:

Code: Select all

./configure --prefix=/custom/snmp513 --with-mib-modules=agent/mibgroup/ucd-snmp/lmSensors --with-ldflags=-lsensors
I get this error:

Code: Select all

checking for C compiler default output file name... configure: error: C compiler cannot create executables
If I configure with --with-mib-modules=ucd-snmp/lmSensors I get the same error.

Anyone a solution?
I just downloaded the latest src-package (tar.gz) of Net-SNMP and extracted all files in the directory net-snmp-5.1.3/

TIA.
sf_alpha
Posts: 9
Joined: Fri Jul 01, 2005 10:36 am

Post by sf_alpha »

RattleSn@ke wrote:
lucky wrote:hi.

i had the same problem... i had to build net-snmp with lm_sensors flag!
Ok!
But when I try to configure with the following command:

Code: Select all

./configure --prefix=/custom/snmp513 --with-mib-modules=agent/mibgroup/ucd-snmp/lmSensors --with-ldflags=-lsensors
I get this error:

Code: Select all

checking for C compiler default output file name... configure: error: C compiler cannot create executables
If I configure with --with-mib-modules=ucd-snmp/lmSensors I get the same error.

Anyone a solution?
I just downloaded the latest src-package (tar.gz) of Net-SNMP and extracted all files in the directory net-snmp-5.1.3/

TIA.
I looks in gentoo ebuild. It configure only with --with-mib-modules=ucd-snmp/lmSensors

But it use the patch attached ..
Attachments
net-snmp-lm_sensors.patch
net-snmp patch
(13.37 KiB) Downloaded 3246 times
jrichardson
Cacti User
Posts: 66
Joined: Tue Mar 22, 2005 10:11 am

Voltage Graphs decimal place

Post by jrichardson »

Thanks for the templates, I've had no issues in getting them charting. The only issue I have, is that it appears that the charts are not putting the decimal in the correct place for the volt graphs.

net-snmp reports:
LM-SENSORS-MIB::lmVoltSensorsDevice.2 = STRING: +5V
LM-SENSORS-MIB::lmVoltSensorsDevice.3 = STRING: +12V
LM-SENSORS-MIB::lmVoltSensorsValue.1 = Gauge32: 1799
LM-SENSORS-MIB::lmVoltSensorsValue.2 = Gauge32: 4929
LM-SENSORS-MIB::lmVoltSensorsValue.3 = Gauge32: 12365

However, the values being graphed are getting values such as:
+12V: 124.25
+5V: 51.01
+2.5V: 18.22

Where they should be 12.425V, 5.101V and 1.822 volts.


Where can I change this decimal place?

Thanks
jrichardson
Cacti User
Posts: 66
Joined: Tue Mar 22, 2005 10:11 am

Fixed it

Post by jrichardson »

I fixed my decimal place, using the CDEF function "Divide by 1000" in the Graph Template works for me.
RattleSn@ke
Posts: 17
Joined: Tue Aug 10, 2004 5:44 pm

Post by RattleSn@ke »

Hi everyone!

I GOT IT WORKING! :D :D
Finally, after posting a question to the net-snmp-users mailinglist. Within an hour the answer and a link to the patch! Great! :D

Other question now:
I have copied a script that reads the HDD temperatures.
I've put it in snmpd.conf as exec.

So I get this output when running snmpwalk:

Code: Select all

[root@shaft scripts]# snmpwalk -v 2c -c public localhost .1.3.6.1.4.1.2021.54
UCD-SNMP-MIB::ucdavis.54.1.1 = INTEGER: 1
UCD-SNMP-MIB::ucdavis.54.2.1 = STRING: "/dev/hda"
UCD-SNMP-MIB::ucdavis.54.3.1 = STRING: "/bin/sh /custom/snmp513/bin/hdd_temperature /dev/hda"
UCD-SNMP-MIB::ucdavis.54.100.1 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.54.101.1 = STRING: "33"
UCD-SNMP-MIB::ucdavis.54.102.1 = INTEGER: 0
UCD-SNMP-MIB::ucdavis.54.103.1 = ""
So where the 33 is the temperature. But how do I use this data in Cacti so I get a nice graph?? Like the one my local version is creating ...

The local version is running quite nice! (see attachment)
Attachments
hddtemp.gif
hddtemp.gif (8.62 KiB) Viewed 108686 times
sf_alpha
Posts: 9
Joined: Fri Jul 01, 2005 10:36 am

Re: Fixed it

Post by sf_alpha »

jrichardson wrote:I fixed my decimal place, using the CDEF function "Divide by 1000" in the Graph Template works for me.
I need to fix this. May Different Version of net-snmp gives different value.
jrichardson
Cacti User
Posts: 66
Joined: Tue Mar 22, 2005 10:11 am

Re: Fixed it

Post by jrichardson »

sf_alpha wrote: I need to fix this. May Different Version of net-snmp gives different value.
I'm not sure if it's my version of net-snmp, lm_sensors or the particular sensor module that I'm using. net-snmp should just return via SNMP whatever it gets from lm_sensors, I would think.
RattleSn@ke
Posts: 17
Joined: Tue Aug 10, 2004 5:44 pm

Post by RattleSn@ke »

whow, finally got everything working as normal.
What I was wondering (and trying) is how do I graph both cpu and case temperature in one single graph?

How do I select the two datasources in one graph template??

Tnx.
sf_alpha
Posts: 9
Joined: Fri Jul 01, 2005 10:36 am

Post by sf_alpha »

RattleSn@ke wrote:whow, finally got everything working as normal.
What I was wondering (and trying) is how do I graph both cpu and case temperature in one single graph?

How do I select the two datasources in one graph template??

Tnx.
You need custom data templates (using OID) to get information
for each temp sensors (using a few datasources in one data templates). And then new graph template that add serveral temperature graph on it.
You may need to crate data templates for each host because lm_sensors sometimes not return temperature value in same order (But mostly the same).

Try snmpwalk :)

Code: Select all

sf_alpha@dekdoi ~ $ snmpwalk -c public -v 1 localhost lmTempSensors
LM-SENSORS-MIB::lmTempSensorsIndex.1 = INTEGER: 0
LM-SENSORS-MIB::lmTempSensorsIndex.2 = INTEGER: 1
LM-SENSORS-MIB::lmTempSensorsDevice.1 = STRING: M/B Temp
LM-SENSORS-MIB::lmTempSensorsDevice.2 = STRING: CPU Temp
LM-SENSORS-MIB::lmTempSensorsValue.1 = Gauge32: 51000
LM-SENSORS-MIB::lmTempSensorsValue.2 = Gauge32: 63000
sf_alpha@dekdoi ~ $ snmpwalk -c public -v 1 localhost -O n lmTempSensors
.1.3.6.1.4.1.2021.13.16.2.1.1.1 = INTEGER: 0
.1.3.6.1.4.1.2021.13.16.2.1.1.2 = INTEGER: 1
.1.3.6.1.4.1.2021.13.16.2.1.2.1 = STRING: M/B Temp
.1.3.6.1.4.1.2021.13.16.2.1.2.2 = STRING: CPU Temp
.1.3.6.1.4.1.2021.13.16.2.1.3.1 = Gauge32: 51000
.1.3.6.1.4.1.2021.13.16.2.1.3.2 = Gauge32: 63000

This is limit of cacti. Indexes SNMP Query must give same output value and lm_ Sensors gives only 1 output at each sensors on it own index, Not every sensors (Every host not have same numbers of sensors).

-----

Code: Select all

sf_alpha@dekdoi ~ $ snmpwalk -c public -v 1 -O n localhost lmVoltSensors
.1.3.6.1.4.1.2021.13.16.4.1.1.1 = INTEGER: 0
.1.3.6.1.4.1.2021.13.16.4.1.1.2 = INTEGER: 1
.1.3.6.1.4.1.2021.13.16.4.1.1.3 = INTEGER: 2
.1.3.6.1.4.1.2021.13.16.4.1.1.4 = INTEGER: 3
.1.3.6.1.4.1.2021.13.16.4.1.1.5 = INTEGER: 4
.1.3.6.1.4.1.2021.13.16.4.1.1.6 = INTEGER: 5
.1.3.6.1.4.1.2021.13.16.4.1.1.7 = INTEGER: 6
.1.3.6.1.4.1.2021.13.16.4.1.1.8 = INTEGER: 7
.1.3.6.1.4.1.2021.13.16.4.1.2.1 = STRING: VCore
.1.3.6.1.4.1.2021.13.16.4.1.2.2 = STRING: +3.3V
.1.3.6.1.4.1.2021.13.16.4.1.2.3 = STRING: +5V
.1.3.6.1.4.1.2021.13.16.4.1.2.4 = STRING: +12V
.1.3.6.1.4.1.2021.13.16.4.1.2.5 = STRING: -12V
.1.3.6.1.4.1.2021.13.16.4.1.2.6 = STRING: -5V
.1.3.6.1.4.1.2021.13.16.4.1.2.7 = STRING: V5SB
.1.3.6.1.4.1.2021.13.16.4.1.2.8 = STRING: VBat
.1.3.6.1.4.1.2021.13.16.4.1.3.1 = Gauge32: 1488
.1.3.6.1.4.1.2021.13.16.4.1.3.2 = Gauge32: 3120
.1.3.6.1.4.1.2021.13.16.4.1.3.3 = Gauge32: 5080
.1.3.6.1.4.1.2021.13.16.4.1.3.4 = Gauge32: 11491
.1.3.6.1.4.1.2021.13.16.4.1.3.5 = Gauge32: 18446744073709539256
.1.3.6.1.4.1.2021.13.16.4.1.3.6 = Gauge32: 18446744073709546117
.1.3.6.1.4.1.2021.13.16.4.1.3.7 = Gauge32: 5456
.1.3.6.1.4.1.2021.13.16.4.1.3.8 = Gauge32: 3536
sf_alpha@dekdoi ~ $ snmpwalk -c public -v 1 localhost lmVoltSensors
LM-SENSORS-MIB::lmVoltSensorsIndex.1 = INTEGER: 0
LM-SENSORS-MIB::lmVoltSensorsIndex.2 = INTEGER: 1
LM-SENSORS-MIB::lmVoltSensorsIndex.3 = INTEGER: 2
LM-SENSORS-MIB::lmVoltSensorsIndex.4 = INTEGER: 3
LM-SENSORS-MIB::lmVoltSensorsIndex.5 = INTEGER: 4
LM-SENSORS-MIB::lmVoltSensorsIndex.6 = INTEGER: 5
LM-SENSORS-MIB::lmVoltSensorsIndex.7 = INTEGER: 6
LM-SENSORS-MIB::lmVoltSensorsIndex.8 = INTEGER: 7
LM-SENSORS-MIB::lmVoltSensorsDevice.1 = STRING: VCore
LM-SENSORS-MIB::lmVoltSensorsDevice.2 = STRING: +3.3V
LM-SENSORS-MIB::lmVoltSensorsDevice.3 = STRING: +5V
LM-SENSORS-MIB::lmVoltSensorsDevice.4 = STRING: +12V
LM-SENSORS-MIB::lmVoltSensorsDevice.5 = STRING: -12V
LM-SENSORS-MIB::lmVoltSensorsDevice.6 = STRING: -5V
LM-SENSORS-MIB::lmVoltSensorsDevice.7 = STRING: V5SB
LM-SENSORS-MIB::lmVoltSensorsDevice.8 = STRING: VBat
LM-SENSORS-MIB::lmVoltSensorsValue.1 = Gauge32: 1488
LM-SENSORS-MIB::lmVoltSensorsValue.2 = Gauge32: 3120
LM-SENSORS-MIB::lmVoltSensorsValue.3 = Gauge32: 5080
LM-SENSORS-MIB::lmVoltSensorsValue.4 = Gauge32: 11491
LM-SENSORS-MIB::lmVoltSensorsValue.5 = Gauge32: 18446744073709539256
LM-SENSORS-MIB::lmVoltSensorsValue.6 = Gauge32: 18446744073709546117
LM-SENSORS-MIB::lmVoltSensorsValue.7 = Gauge32: 5456
LM-SENSORS-MIB::lmVoltSensorsValue.8 = Gauge32: 3536
sf_alpha@dekdoi ~ $ snmpwalk -c public -v 1 localhost lmVoltSensors
I had problems with negative value. I have try 64bit 2's complement cannot solve this and it return wrong value. I don't know this is rrdtool bugs or cacti :P
Alives
Cacti User
Posts: 103
Joined: Mon Jul 11, 2005 11:39 am

Post by Alives »

is it possible for net-snmp to compile with lm sensors in win32?
Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests