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

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

Moderators: Developers, Moderators

Post Reply
jderefinko
Posts: 4
Joined: Fri Mar 25, 2005 5:38 am
Location: France
Contact:

SNMP MIB issues

Post by jderefinko »

Hi,

For all of you having the following error under Debian/Ubuntu systems, this did the trick for me :

Error :

Code: Select all

# snmpwalk -v 2c -c public -m ALL localhost tempsensors
LM-SENSORS-MIB::lmTempSensorsTable = No Such Object available on this agent at this OID
Solution :
1. You should have two config files called /etc/sensors.conf and /etc/sensors3.conf
2. Make a backup of /etc/sensors.conf (you never know :wink: ):

Code: Select all

mv /etc/sensors.conf /etc/sensors.conf.bkp
3. Link sensors.conf to sensors3.conf

Code: Select all

ln -s /etc/sensors3.conf /etc/sensors.conf 
4. Restart SNMP daemon

Code: Select all

/etc/init.d/snmpd restart
Now this shoud work fine :

Code: Select all

# snmpwalk -v 2c -c public -m ALL localhost tempsensors 
Worked like a charm for me !
smc
Posts: 1
Joined: Tue Jun 02, 2009 9:22 pm
Location: Auckland, New Zealand

Re: SNMP MIB issues

Post by smc »

jderefinko wrote:Hi,

For all of you having the following error under Debian/Ubuntu systems, this did the trick for me :

Error :

Code: Select all

# snmpwalk -v 2c -c public -m ALL localhost tempsensors
LM-SENSORS-MIB::lmTempSensorsTable = No Such Object available on this agent at this OID
Solution :
1. You should have two config files called /etc/sensors.conf and /etc/sensors3.conf
2. Make a backup of /etc/sensors.conf (you never know :wink: ):

Code: Select all

mv /etc/sensors.conf /etc/sensors.conf.bkp
3. Link sensors.conf to sensors3.conf

Code: Select all

ln -s /etc/sensors3.conf /etc/sensors.conf 
4. Restart SNMP daemon

Code: Select all

/etc/init.d/snmpd restart
Now this shoud work fine :

Code: Select all

# snmpwalk -v 2c -c public -m ALL localhost tempsensors 
Worked like a charm for me !
Thanks for that, worked for me too :)

I am, however, having problems importing the FanSensors 8x template as follows:

Code: Select all

Cacti has imported the following items:

GPRINT Preset
[success] Exact Numbers [update]

Graph Template
[success] Sensors - ucd/net - lmSensors - Fan Sensors (8x) [update]
   + Found Dependency: (GPRINT Preset) Exact Numbers
   + Unmet Dependency: (Data Template Item)
   + Unmet Dependency: (Data Template Item)
   + Unmet Dependency: (Data Template Item)
   + Unmet Dependency: (Data Template Item)
   + Unmet Dependency: (Data Template Item)
   + Unmet Dependency: (Data Template Item)
   + Unmet Dependency: (Data Template Item)
   + Unmet Dependency: (Data Template Item)
   + Unmet Dependency: (Data Template Item)
   + Unmet Dependency: (Data Template Item)
   + Unmet Dependency: (Data Template Item)
   + Unmet Dependency: (Data Template Item)
   + Unmet Dependency: (Data Template Item)
   + Unmet Dependency: (Data Template Item)
   + Unmet Dependency: (Data Template Item)
   + Unmet Dependency: (Data Template Item)
   + Unmet Dependency: (Data Template Item)
   + Unmet Dependency: (Data Template Item)
   + Unmet Dependency: (Data Template Item)
   + Unmet Dependency: (Data Template Item)
   + Unmet Dependency: (Data Template Item)
   + Unmet Dependency: (Data Template Item)
   + Unmet Dependency: (Data Template Item)
   + Unmet Dependency: (Data Template Item)
   + Unmet Dependency: (Data Template Item)
   + Unmet Dependency: (Data Template Item)
   + Unmet Dependency: (Data Template Item)
   + Unmet Dependency: (Data Template Item)
   + Unmet Dependency: (Data Template Item)
   + Unmet Dependency: (Data Template Item)
   + Unmet Dependency: (Data Template Item)
   + Unmet Dependency: (Data Template Item) 
This has been mentioned a few times in this thread but I haven't seen any ways to fix it..
ehall
Cacti User
Posts: 246
Joined: Fri Dec 09, 2005 3:42 pm

Post by ehall »

I think that error means that the data source in the graph have become disassociated from the graph objects. Edit the 8x fan graph template, scroll down to the "Graph Item Inputs" area, and verify that each of the "Fan Sensor N" items are linked to the appropriate four graph elements.
blubbersuelze
Posts: 40
Joined: Mon Jun 15, 2009 12:55 pm

Post by blubbersuelze »

It's OK i got my Error ...
ehall
Cacti User
Posts: 246
Joined: Fri Dec 09, 2005 3:42 pm

Post by ehall »

I posted a new version of the script with many significant enhancements. The biggest change is a switch from the expensive and slow script query interface to the persistent and fast script server interface. I also dropped the comma-separated parameters and switched to a colon-separated "bundle" for SNMP arguments, tightened up the array and variable management, added a lot more error checking, and otherwise did a complete rewrite of the script.

Due to the changes, the script and resource xml files need to be reinstalled and any data queries need to be reimported. However the existing graphs and data sources should continue to operate afterwards.

I've also moved the files to this page on my web server so that I can more easily maintain them
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

ehall wrote:I've also moved the files to this page on my web server so that I can more easily maintain them
Thank you for providing your Cacti Scripts. Would it be an option to publish them to the Script Repository, see 4th link of my sig?
Reinhard
kartoon
Posts: 1
Joined: Fri Jun 26, 2009 1:00 pm

Post by kartoon »

Hello,

Everything seems to be Ok, except the graph is still at a value of "Nan"
There is the log:
06/26/2009 07:55:09 PM - CMDPHP: Poller[0] Host[3] DS[189] CMD: /usr/bin/php -q /var/www/ns/htdocs/cacti/scripts/netsnmp_lmsensors.php coretemp ns.kartooon.fr, public, 3, netadmin, password, MD5, password, DES, , 161, 500 get sensorReading 1, output: 58000
06/26/2009 07:55:09 PM - CMDPHP: Poller[0] Host[3] DS[190] CMD: /usr/bin/php -q /var/www/ns/htdocs/cacti/scripts/netsnmp_lmsensors.php coretemp ns.kartooon.fr, public, 3, netadmin, password, MD5, password, DES, , 161, 500 get sensorReading 2, output: 57000
I don't really understand what s the problem.

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

Post by ehall »

kartoon wrote:Hello,

Everything seems to be Ok, except the graph is still at a value of "Nan"
There is the log:
06/26/2009 07:55:09 PM - CMDPHP: Poller[0] Host[3] DS[189] CMD: /usr/bin/php -q /var/www/ns/htdocs/cacti/scripts/netsnmp_lmsensors.php coretemp ns.kartooon.fr, public, 3, netadmin, password, MD5, password, DES, , 161, 500 get sensorReading 1, output: 58000
06/26/2009 07:55:09 PM - CMDPHP: Poller[0] Host[3] DS[190] CMD: /usr/bin/php -q /var/www/ns/htdocs/cacti/scripts/netsnmp_lmsensors.php coretemp ns.kartooon.fr, public, 3, netadmin, password, MD5, password, DES, , 161, 500 get sensorReading 2, output: 57000
The data template has an input limit of 255 for temperature and voltage, but the output above is showing 58,000 and 57,000 for those samples. Nothing is that hot, so there is a problem with the data being returned by lmsensors. You need to get lmsensors working correctly.

Also you are using an older version of the script and its associated XML definition file.
helzerr
Cacti User
Posts: 54
Joined: Sun Feb 01, 2004 3:10 am
Location: Orlando, FL
Contact:

Post by helzerr »

Thank you for the enhancements, the upgraded of my previous lmSensors setup was flawless.
a2287884
Posts: 10
Joined: Thu Jun 11, 2009 4:03 am
Contact:

Re: ucd/net-SNMP lmSensors -- update June 21, 2009

Post by a2287884 »

ehall wrote: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 <--
quote]Cacti Version - 0.8.7e
Plugin Architecture - 2.5
Poller Type - CMD.php
Server Info - Windows NT 5.1
Web Server - Apache/2.2.11 (Win32) PHP/5.2.9-2
PHP - 5.2.9-2
PHP Extensions - bcmath, calendar, com_dotnet, ctype, session, filter, ftp, hash, iconv, json, odbc, pcre, Reflection, date, libxml, standard, tokenizer, zlib, SimpleXML, dom, SPL, wddx, xml, xmlreader, xmlwriter, apache2handler, bz2, curl, dba, dbase, fdf, gd, gettext, gmp, imap, interbase, ldap, mbstring, mcrypt, mhash, mime_magic, ming, msql, mysql, mysqli, openssl, PDO, PDO_Firebird, pdo_mysql, PDO_ODBC, pdo_sqlite, shmop, snmp, soap, sockets, SQLite, tidy, xmlrpc, xsl, zip, exif, Zend Optimizer
MySQL - 5.0.77-community-nt
RRDTool - 1.2.30
SNMP - snmpwalk [OPTIONS] AGENT [OID]

Version: 5.4.2.1
Web: http://www.net-snmp.org/
Email: net-snmp-coders@lists.sourceforge.net

OPTIONS:
-h, --help display this help message
-H display configuration file directives understood
-v 1|2c|3 specifies SNMP version to use
-V, --version display package version number
SNMP Version 1 or 2c specific
-c COMMUNITY set the community string
SNMP Version 3 specific
-a PROTOCOL set authentication protocol (MD5|SHA)
-A PASSPHRASE set authentication protocol pass phrase
-e ENGINE-ID set security engine ID (e.g. 800000020109840301)
-E ENGINE-ID set context engine ID (e.g. 800000020109840301)
-l LEVEL set security level (noAuthNoPriv|authNoPriv|authPriv)
-n CONTEXT set context name (e.g. bridge1)
-u USER-NAME set security name (e.g. bert)
-x PROTOCOL set privacy protocol (DES|AES)
-X PASSPHRASE set privacy protocol pass phrase
-Z BOOTS,TIME set destination engine boots/time
General communication options
-r RETRIES set the number of retries
-t TIMEOUT set the request timeout (in seconds)
Debugging
-d dump input/output packets in hexadecimal
-D TOKEN[,...] turn on debugging output for the specified TOKENs
(ALL gives extremely verbose debugging output)
General options
-m MIB[:...] load given list of MIBs (ALL loads everything)
-M DIR[:...] look in given list of directories for MIBs
-P MIBOPTS Toggle various defaults controlling MIB parsing:
u: allow the use of underlines in MIB symbols
c: disallow the use of "--" to terminate comments
d: save the DESCRIPTIONs of the MIB objects
e: disable errors when MIB symbols conflict
w: enable warnings when MIB symbols conflict
W: enable detailed warnings when MIB symbols conflict
R: replace MIB symbols from latest module
-O OUTOPTS Toggle various defaults controlling output display:
0: print leading 0 for single-digit hex characters
a: print all strings in ascii format
b: do not break OID indexes down
e: print enums numerically
E: escape quotes in string indices
f: print full OIDs on output
n: print OIDs numerically
q: quick print for easier parsing
Q: quick print with equal-signs
s: print only last symbolic element of OID
S: print MIB module-id plus last element
t: print timeticks unparsed as numeric integers
T: print human-readable text along with hex strings
u: print OIDs using UCD-style prefix suppression
U: don't print units
v: print values only (not OID = value)
x: print all strings in hex format
X: extended index format
-I INOPTS Toggle various defaults controlling input parsing:
b: do best/regex matching to find a MIB node
h: don't apply DISPLAY-HINTs
r: do not check values for range/type legality
R: do random access to OID labels
u: top-level OIDs must have '.' prefix (UCD-style)
s SUFFIX: Append all textual OIDs with SUFFIX before parsing
S PREFIX: Prepend all textual OIDs with PREFIX before parsing
-L LOGOPTS Toggle various defaults controlling logging:
e: log to standard error
o: log to standard output
n: don't log at all
f file: log to the specified file
s facility: log to syslog (via the specified facility)

(variants)
[EON] pri: log to standard error, output or /dev/null for level 'pri' and above
[EON] p1-p2: log to standard error, output or /dev/null for levels 'p1' to 'p2'
[FS] pri token: log to file/syslog for level 'pri' and above
[FS] p1-p2 token: log to file/syslog for levels 'p1' to 'p2'
-C APPOPTS Set various application specific behaviours:
p: print the number of variables found
i: include given OID in the search range
I: don't include the given OID, even if no results are returned
c: do not check returned OIDs are increasing
t: Display wall-clock time to complete the request
Plugins
  • Thresholds (thold - v0.4.1)
    Cacti Log View (CLog - v1.21)
    Host Info (hostinfo - v0.2)
    Cycle Graphs (Cycle Graphs - v0.7)
    Login Page Mod (loginmod - v1.0)
    Device Monitoring (monitor - v0.8.2)
    Notices (Notices - v0.2c)
    Realtime Graph Viewer (realtime - v0.36)
    Router Configs (routerconfigs - v0.1)
    Global Plugin Settings (settings - v0.5)
    Spike Killer for Cacti Graphs (spikekill - v1.0)
    SuperLinks (superlinks - v0.8)
    Network Tools (tools - v0.3)
    Update Checker (update - v0.4)
    Watermark (watermark - v0.1)
    PHP Network Weathermap (weathermap - v0.96a)
    Device Tracking (mactrack - v1.1)
    PHP Network Managing (PHP Network Managing - v0.6.1)
    FlowView (flowview - v0.5.2)
    Network Discovery (discovery - v0.8.5)
    Create Aggregate Graphs (aggregate - v0.70 Beta 1)
    Documents (docs - v0.1)
    Cacti-ReportIt (reportit - v0.7.0)
    Large Site Performane Booster (boost - v2.4)
[/quote]


************* i am still not able to import template without error
it shows umet dependancy error
please suggest the proper way
and one more thing do i have to restart server after sensor-detect command
Heiko
Cacti User
Posts: 77
Joined: Wed Apr 23, 2008 11:03 am

Post by Heiko »

Hi,

thx for these great scripts, didnt had much trouble to get it working,
only had to restart the snmpd on the machine than all sensors are shown.

keep up the good work.
FastCat
Posts: 5
Joined: Sun Oct 18, 2009 8:53 am
Location: Russia, Moscow

Post by FastCat »

ehall wrote:http://www.eric-a-hall.com/software/cac ... lmsensors/ see this page for the tarball and instructions
He did everything as the instructions read:

Code: Select all

home:~ # sensors
smsc47b397-isa-0480
Adapter: ISA adapter
temp1:       +46°C
temp2:       +31°C
temp3:       +36°C
temp4:        +0°C
fan1:     1797 RPM
fan2:       82 RPM
fan3:      814 RPM
fan4:      984 RPM

Code: Select all

home:~ # snmpd -Dmib_init
No log handling enabled - turning on stderr logging
registered debug token mib_init, 1
mib_init: initializing: usmConf
...
mib_init: initializing: lmSensors
...
mib_init: initializing: ipv6
But the graphics are not drawing. Writes: No sensor data was returned from SNMP

Code: Select all

Data Query Debug Information 
 
+ Running data query [12].
+ Found type = '6 '[script query].
+ Found data query XML file at '/srv/www/htdocs/cacti/resource/script_server/netsnmp_lmsensors_voltage.xml'
+ XML file parsed ok.
+ Executing script for list of indexes '/usr/bin/php -q /srv/www/htdocs/cacti/scripts/ss_netsnmp_lmsensors.php localhost:2:superpublic:::::::161:500 voltage index'
+ Executing script query '/usr/bin/php -q /srv/www/htdocs/cacti/scripts/ss_netsnmp_lmsensors.php localhost:2:superpublic:::::::161:500 voltage query sensorDevice'
+ Found item [sensorDevice=' No sensor data was returned from SNMP'] index: FATAL
+ Executing script query '/usr/bin/php -q /srv/www/htdocs/cacti/scripts/ss_netsnmp_lmsensors.php localhost:2:superpublic:::::::161:500 voltage query sensorName'
+ Found item [sensorName=' No sensor data was returned from SNMP'] index: FATAL
+ Found data query XML file at '/srv/www/htdocs/cacti/resource/script_server/netsnmp_lmsensors_voltage.xml'
+ Found data query XML file at '/srv/www/htdocs/cacti/resource/script_server/netsnmp_lmsensors_voltage.xml'
+ Found data query XML file at '/srv/www/htdocs/cacti/resource/script_server/netsnmp_lmsensors_voltage.xml'
+ Found data query XML file at '/srv/www/htdocs/cacti/resource/script_server/netsnmp_lmsensors_voltage.xml'
In what could be the problem ? Help Board.
sander815
Posts: 13
Joined: Tue Aug 17, 2004 2:30 am

Post by sander815 »

i also have the same troubles

Code: Select all

[root@homeserver log]# sensors
lm78-isa-0290
Adapter: ISA adapter
VCore 1:   +2.46 V  (min =  +0.00 V, max =  +3.49 V)
VCore 2:   +3.70 V  (min =  +0.40 V, max =  +2.56 V)
+3.3V:     +3.31 V  (min =  +2.45 V, max =  +0.35 V)
+5V:       +5.56 V  (min =  +0.46 V, max =  +0.00 V)
+12V:     +13.74 V  (min =  +6.81 V, max = +13.25 V)
-12V:      -0.56 V  (min = -10.68 V, max =  -0.17 V)
-5V:       -4.74 V  (min =  -0.87 V, max =  -3.18 V)
fan1:        0 RPM  (min = 5273 RPM, div = 8)
fan2:     4440 RPM  (min = 2636 RPM, div = 8)
fan3:        0 RPM  (min = 3515 RPM, div = 2)
temp:      +22.0°C  (high =   +10°C, hyst =   +31°C)   ALARM
alarms:   Chassis intrusion detection                  ALARM
[root@homeserver log]# snmpwalk -v 2c -c public localhost sensors
LM-SENSORS-MIB::lmSensors = No more variables left in this MIB View (It is past the end of the MIB tree)
[root@homeserver log]#

as far as i can see lmsensors is compiled with net-snmp":

Code: Select all

 snmpd -Dmib_i

NET-SNMP version 5.1.2
 diskio
mib_init: initializing: lmSensors
mib_init: initializing: ipv6
mib_init: initializing: system_mib

but i don't see the data:

Code: Select all

+ Running data query [10].
+ Found type = '4 '[script query].
+ Found data query XML file at '/var/www/cacti-0.8.7e/resource/script_server/netsnmp_lmsensors_fan.xml'
+ XML file parsed ok.
+ Executing script for list of indexes '/usr/bin/php -q /var/www/cacti-0.8.7e/scripts/ss_netsnmp_lmsensors.php 127.0.0.1:2:public:::MD5::DES::161:500 fan index'
+ Executing script query '/usr/bin/php -q /var/www/cacti-0.8.7e/scripts/ss_netsnmp_lmsensors.php 127.0.0.1:2:public:::MD5::DES::161:500 fan query sensorDevice'
+ Found item [sensorDevice=' No sensor data was returned from SNMP'] index: FATAL
+ Executing script query '/usr/bin/php -q /var/www/cacti-0.8.7e/scripts/ss_netsnmp_lmsensors.php 127.0.0.1:2:public:::MD5::DES::161:500 fan query sensorName'
+ Found item [sensorName=' No sensor data was returned from SNMP'] index: FATAL
+ Found data query XML file at '/var/www/cacti-0.8.7e/resource/script_server/netsnmp_lmsensors_fan.xml'
+ Found data query XML file at '/var/www/cacti-0.8.7e/resource/script_server/netsnmp_lmsensors_fan.xml'
+ Found data query XML file at '/var/www/cacti-0.8.7e/resource/script_server/netsnmp_lmsensors_fan.xml'
FastCat
Posts: 5
Joined: Sun Oct 18, 2009 8:53 am
Location: Russia, Moscow

Post by FastCat »

Help pls understand and solve my problem http://forums.cacti.net/viewtopic.php?p ... ht=#175467 ?
drgrog
Posts: 1
Joined: Mon Mar 15, 2010 5:56 pm

graph data incorrect

Post by drgrog »

Hi, I am new to Cacti, and I'm having a strange problem with this script/template, and was wondering if anyone can see what I'm doing wrong ...

I have installed the script as per instructions, then created a copy of the template for the 3x temperature sensors I have. When I look at the graph, the value for one of the sensors is constantly 3degC higher than what 'sensors' and snmp show. The other two values are fine.

Code: Select all

user@box:~$ sensors
smsc47b397-isa-0480
Adapter: ISA adapter
fan1:       2043 RPM
fan2:          0 RPM
fan3:       1263 RPM
fan4:       1006 RPM
temp1:       +33.0°C
temp2:       +26.0°C
temp3:       +24.0°C
temp4:        +0.0°C

user@box:~$ snmpwalk -c public -v 1 localhost lmTempSensorsValue
LM-SENSORS-MIB::lmTempSensorsValue.1 = Gauge32: 33000
LM-SENSORS-MIB::lmTempSensorsValue.2 = Gauge32: 26000
LM-SENSORS-MIB::lmTempSensorsValue.3 = Gauge32: 24000
Even running the script manually gives the right data:

Code: Select all

sudo php /usr/share/cacti/site/scripts/ss_netsnmp_lmsensors.php 127.0.0.1:1:public:user:pass:MD5::DES::161:500 temperature get sensorReading 1
33
Yet the data for temp1 shown on the graph is wrong, it is shown a steady 36 degrees for the last hour of the attached graph, wheras the actual temp was at 33 for that hour. Temp2 and temp3 are shown correctly.

All three data sources use the same template, and the problem is the same regardless of the graph template used, so I'm not sure where to look next.

Any help or ideas would be appreciated, Thanks. (Edit: Oh, I'm running Cacti 0.8.7d with lmsensors script 0.8)
Attachments
graph_image.php.png
graph_image.php.png (18.55 KiB) Viewed 11470 times
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests