ucd/net-SNMP lmSensors -- update November 11, 2010

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

Moderators: Developers, Moderators

Post Reply
ehall
Cacti User
Posts: 246
Joined: Fri Dec 09, 2005 3:42 pm

ucd/net-SNMP lmSensors -- update November 11, 2010

Post by ehall »

I have been working to get different kinds of hardware monitoring working in a consistent manner. This is the ucd/net-snmp lmSensors package.

Here is what the final result looks like for one of my systems, and shows the fan speeds, thermal probe temperatures, and voltage levels for all of the available sensors on that server:

Image

There are some caveats here. Obviously, you must have lm_sensors installed and working, and you must have the ucd-snmp/lmSensors extension compiled into your version of net-snmp. Alos note that net-snmp uses textual string parsing to determine what kind of sensor you are using---sensor names with a "V" are mapped to voltage sensors, sensor names with "fan" are mapped to fans, and sensor names with "temp" are mapped to thermals. If you don't use that naming, your sensors will end up in the miscellaneous pool, and this script doesn't look in that pool.

--> see this page for the tarball and instructions <--
Last edited by ehall on Thu Nov 11, 2010 9:20 pm, edited 21 times in total.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Wow, nice! Was just googling around for this bit. But to be honest, I'm currently not getting lmSensors to give me data. net-snmp-config tells me it is included. Is there anything else to be aware of? (Forgive me to be off-topic)
For used software, please see my signature.
Reinhard
ehall
Cacti User
Posts: 246
Joined: Fri Dec 09, 2005 3:42 pm

Post by ehall »

Do you have lm_sensors configured and working? That's the first step and can be a kind of a pain to get fully working automatically.

First things first: do you have the "sensors" command in your path, and does it display any meaningful output?

If not, you should have a "sensors-detect" command installed somewhere that will probe for the different kinds of sensors available. If it it detects them, it will spit out a series of modprobe lines that tell you which sensors were discovered. Once those modules are loaded you can tweak /etc/sensors.conf to manipulate things like labels, fan multipliers, and so forth.

sensors-detect will also offer to create an /etc/sysconfig/lm_sensors control file (or something like it, depending on platform). I usually expirement with those and other availalbe modules, and put them into the sysconfig/kernel file so that they are loaded on boot too.

All of the above comes from installing the appropriate lm_sensors package, of course (check the links in top message). Once that's all working, adding support to net-snmp usually just requires tweaking the configure script and building a new package, but that's not even needed on some platforms.

Once you spend enough time with it to wrap your head around the architecture, it is pretty straightforward.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Thanks for the links. IBM systems are supposed not to work with current lm_sensors ...Damn it
Reinhard
ehall
Cacti User
Posts: 246
Joined: Fri Dec 09, 2005 3:42 pm

Post by ehall »

lm_sensors talks to regular kernel modules, and there are some independent modules floating around separate from the ones that are bundled into lm_sensors itself. Not saying that you'll find one for your boxes but it's worth googling for.
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

From what I remember when I was playing with lm_sensors, you have to load a module for the base, and then each componet you want to monitor. Or was that APCI?

...
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
ehall
Cacti User
Posts: 246
Joined: Fri Dec 09, 2005 3:42 pm

Post by ehall »

More or less, but on the lesser end of the scale it's so generic as to not matter. Some of the higher end sensor modules can have a lot of dependencies but the lower end sensors just need an SMBus or ISA driver (both of which are bundled into lm_sensors already).
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

ehall wrote:... lower end sensors just need an SMBus...
:evil: lower end: as to IBM, that's not the lower end. It is not supported and lm_sensors is supposed to destroy the boot EEPROM as to the current documentation. It refers only to Thinkpads (my testing host), but does not run on Blade Centers either cause only the Vendor is taken into account. :evil:
SO: no data for me :cry:
Reinhard
User avatar
Cornfed
Posts: 12
Joined: Thu Feb 24, 2005 11:02 am
Location: MA

What do I do?

Post by Cornfed »

I'm confused what to do with the files. I was able to import the XML files, and that looks fine.

What kind of values do I put in for Index Type, Index Value, and Output Type ID?

What do I do with the PHP file? In the scripts directory?

I'm used to the older verions of cacti (before the xml), and haven't worked with the xml files before. (I'm now using the most current version)
ehall
Cacti User
Posts: 246
Joined: Fri Dec 09, 2005 3:42 pm

Post by ehall »

From the main console you can use the "import templates" menu on the left to pull in the XML files. That will create the graph templates, the data query, and so forth. Then go into the device screen, and add the data query to a device that has lmsensors and net-snmp (compiled with lmsensors support). If everything is working on the back-end system the sensors should show up.
User avatar
Cornfed
Posts: 12
Joined: Thu Feb 24, 2005 11:02 am
Location: MA

Post by Cornfed »

I'm almost there. When I add the data query to the device, click create, I get this message. I don't know what it's asking.

Is the Index Type = LM-SENSORS-MIB::lmFanSensorsValue
Is the Index Value = (1,2,3, number of fans)
(as in LM-SENSORS-MIB::lmFanSensorsValue.1)

No idea what Output Typ ID is. I'm guessing that's a number that I would assign to make this fan different from other fans I might track on this device.
Attachments
Screen shot
Screen shot
cacti-question.jpg (13.89 KiB) Viewed 133360 times
ehall
Cacti User
Posts: 246
Joined: Fri Dec 09, 2005 3:42 pm

Post by ehall »

You shouldn't be getting prompted for that information, since the script will populate the data as needed.

One possibility is that you are not using 0.8.6h which is what the XML and scripts were written to work with.

Although actually it kind of looks like you tried to add the graph template or data template to the device. You need to add the data query to the device and let it do the work. Once that is done, click the "Verbose Query" link in the Associated Data Query list, and you should get some debug output. Mine shows:

Code: Select all

+ Running data query [32].
+ Found type = '4 '[script query].
+ Found data query XML file at '/var/lib/cacti/resource/script_queries/lmsensors_fan.xml'
+ XML file parsed ok.
+ Executing script for list of indexes '/usr/bin/php -q /var/lib/cacti/scripts/netsnmp_lmsensors.php fan goose.ehsco.com, public, 2, , , 161, 3000 index'
+ Executing script query '/usr/bin/php -q /var/lib/cacti/scripts/netsnmp_lmsensors.php fan goose.ehsco.com, public, 2, , , 161, 3000 query sensorDevice'
+ Found item [sensorDevice='1'] index: 1
+ Found item [sensorDevice='2'] index: 2
+ Executing script query '/usr/bin/php -q /var/lib/cacti/scripts/netsnmp_lmsensors.php fan goose.ehsco.com, public, 2, , , 161, 3000 query sensorName'
+ Found item [sensorName='CPU Fan'] index: 1
+ Found item [sensorName='Case Fan'] index: 2
+ Found data query XML file at '/var/lib/cacti/resource/script_queries/lmsensors_fan.xml'
+ Found data query XML file at '/var/lib/cacti/resource/script_queries/lmsensors_fan.xml'
+ Found data query XML file at '/var/lib/cacti/resource/script_queries/lmsensors_fan.xml'
+ Found data query XML file at '/var/lib/cacti/resource/script_queries/lmsensors_fan.xml'
+ Found data query XML file at '/var/lib/cacti/resource/script_queries/lmsensors_fan.xml'
That shows two fan sensors, named "CPU Fan" and "Case Fan" respectively.
User avatar
Cornfed
Posts: 12
Joined: Thu Feb 24, 2005 11:02 am
Location: MA

Post by Cornfed »

Ahhh, Maybe that's the source of my confusion. Should the tar file have contained lmsensors_fan.xml?

The contents look like all graph templates:

Code: Select all

cacti_graph_template_ucdnet_lmsensors_fan_sensors_8x.xml
cacti_graph_template_ucdnet_lmsensors_fan_sensor.xml
cacti_graph_template_ucdnet_lmsensors_thermal_sensors_8x.xml
cacti_graph_template_ucdnet_lmsensors_thermal_sensor.xml
cacti_graph_template_ucdnet_lmsensors_voltage_sensors_8x.xml
cacti_graph_template_ucdnet_lmsensors_voltage_sensor.xml
netsnmp_lmsensors.php
Did I get the complete archive?

(Thanks for being patient with me on this)
ehall
Cacti User
Posts: 246
Joined: Fri Dec 09, 2005 3:42 pm

Post by ehall »

I'm pretty sure that the 0.8.6h graph templates include all the other templates. I exported them with all dependencies. The 8x templates don't (they are just additional graphs) but the regular ones should have all the data query templates and everything.

Look in the Data Queries screen. Does it have three "ucd/net-snmp - lmSensors - Get XXX Sensors" queries?
User avatar
Cornfed
Posts: 12
Joined: Thu Feb 24, 2005 11:02 am
Location: MA

Post by Cornfed »

First, I tried to re-import the xml file.

Code: Select all


Cacti has imported the following items:

Round Robin Archive
[success] Daily (5 Minute Average) [update]
[success] Weekly (30 Minute Average) [update]
[success] Monthly (2 Hour Average) [update]
[success] Yearly (1 Day Average) [update]

GPRINT Preset
[success] Exact Numbers [update]

Data Input Method
[success] Get Script Data (Indexed) [update]

Data Template
[success] ucd/net - lmSensors - Fan Sensor Reading [update]

Graph Template
[success] ucd/net - lmSensors - Fan Sensor [update]

Then I view the data queries

Code: Select all


Karlnet - Wireless Bridge Statistics
Netware - Get Available Volumes
Netware - Get Processor Information
SNMP - Get Mounted Partitions
SNMP - Get Processor Information
SNMP - Interface Statistics
ucd/net - Get Monitored Partitions
Unix - Get Mounted Partitions

I'm using the Import Templates link to import this xml file.

I was able to write my own perl script to get the fan data via snmp, and get that into Cacti. So I know I have lm_sensors running and net-snmp compiled (./configure --prefix=/usr --with-mib-modules="ucd-snmp/lmSensors" ; make; make install)

Any of this help?
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests