Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


ucd/net-SNMP lmSensors -- update Feb 10, 2007
Goto page 1, 2, 3, 4, 5, 6, 7  Next
 
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates
Author Message
ehall
Cacti User


Joined: 09 Dec 2005
Posts: 160

PostPosted: Wed Jan 25, 2006 12:06 pm    Post subject: ucd/net-SNMP lmSensors -- update Feb 10, 2007 Reply with quote

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:



This model uses a script query which uses SNMP to ask the target for all known sensors of the requested type. Add the appropriate data query to a device that has the ucd-net/snmp lmSensors extensions, and then create new graphs for each of the sensors that you want. Each selected sensor will be created as an individual data-source and graph, like with interfaces.

Graphs can be consolidated by editing and/or using one of the bundled "8x" graph templates, once the underlying data-sources and graphs have been created. If you have 8 items on a host, simply use the Graph Management menu to "add" a new graph, choose the target system, and then point to the data sources you created with the data query. If you have fewer or more than eight items, you can make a copy of the 8x template and add/delete however many more rows you want. Once the consolidated graphs are working, you can delete the sensor-specific one-off graphs, but DO NOT DELETE THE DATA SOURCES.

The screenie below uses the 8x template for voltages, but as you can see in the large image above, the other sensor groups on this host use 2x graphs.



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.

If there are any additional updates to this, I will replace the attachment below.

This was exported from cacti 0.8.6i, using PHP 5. Other combinations may not work.

Other helpful links:

lm_sensors home page
net-snmp home page



cacti-netsnmp-lmsensors.tar.gz
 Description:

Download
 Filename:  cacti-netsnmp-lmsensors.tar.gz
 Filesize:  15.55 KB
 Downloaded:  5955 Time(s)



Last edited by ehall on Fri May 02, 2008 8:19 pm; edited 10 times in total
Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 11740
Location: Muenster, Germany

PostPosted: Wed Jan 25, 2006 12:35 pm    Post subject: Reply with quote

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
Back to top
ehall
Cacti User


Joined: 09 Dec 2005
Posts: 160

PostPosted: Wed Jan 25, 2006 1:03 pm    Post subject: Reply with quote

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.
Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 11740
Location: Muenster, Germany

PostPosted: Thu Jan 26, 2006 3:49 am    Post subject: Reply with quote

Thanks for the links. IBM systems are supposed not to work with current lm_sensors ...Damn it
Reinhard
Back to top
ehall
Cacti User


Joined: 09 Dec 2005
Posts: 160

PostPosted: Thu Jan 26, 2006 12:13 pm    Post subject: Reply with quote

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.
Back to top
rony
Developer/Forum Admin


Joined: 17 Nov 2003
Posts: 5399
Location: Wisconsin, USA

PostPosted: Thu Jan 26, 2006 12:59 pm    Post subject: Reply with quote

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?

...
Back to top
ehall
Cacti User


Joined: 09 Dec 2005
Posts: 160

PostPosted: Thu Jan 26, 2006 7:11 pm    Post subject: Reply with quote

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).
Back to top
gandalf
Developer


Joined: 02 Dec 2004
Posts: 11740
Location: Muenster, Germany

PostPosted: Fri Jan 27, 2006 3:41 pm    Post subject: Reply with quote

ehall wrote:
... lower end sensors just need an SMBus...
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.
SO: no data for me
Reinhard
Back to top
Cornfed



Joined: 24 Feb 2005
Posts: 12
Location: MA

PostPosted: Mon Jan 30, 2006 3:37 pm    Post subject: What do I do? Reply with quote

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)
Back to top
ehall
Cacti User


Joined: 09 Dec 2005
Posts: 160

PostPosted: Mon Jan 30, 2006 3:48 pm    Post subject: Reply with quote

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.
Back to top
Cornfed



Joined: 24 Feb 2005
Posts: 12
Location: MA

PostPosted: Tue Jan 31, 2006 11:53 am    Post subject: Reply with quote

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.



cacti-question.jpg
 Description:
Screen shot
 Filesize:  13.89 KB
 Viewed:  47580 Time(s)

cacti-question.jpg


Back to top
ehall
Cacti User


Joined: 09 Dec 2005
Posts: 160

PostPosted: Tue Jan 31, 2006 12:59 pm    Post subject: Reply with quote

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:
+ 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.
Back to top
Cornfed



Joined: 24 Feb 2005
Posts: 12
Location: MA

PostPosted: Tue Jan 31, 2006 1:42 pm    Post subject: Reply with quote

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:

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)
Back to top
ehall
Cacti User


Joined: 09 Dec 2005
Posts: 160

PostPosted: Wed Feb 01, 2006 12:58 am    Post subject: Reply with quote

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?
Back to top
Cornfed



Joined: 24 Feb 2005
Posts: 12
Location: MA

PostPosted: Wed Feb 01, 2006 11:37 am    Post subject: Reply with quote

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

Code:


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:


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?
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Scripts and Templates All times are GMT - 5 Hours
Goto page 1, 2, 3, 4, 5, 6, 7  Next
Page 1 of 7

 



Powered by phpBB © 2001, 2005 phpBB Group