Bad SNMP query results
Moderators: Developers, Moderators
Bad SNMP query results
Hi Guys,
I'm able to add a device on cacti, but when I look at the SNMP Data Query Results, I am displayed something like this.
May you please help me in fixing the issue.
Graphs from these devices don't work. My previous graphs are working correctly.
Regards,
I'm able to add a device on cacti, but when I look at the SNMP Data Query Results, I am displayed something like this.
May you please help me in fixing the issue.
Graphs from these devices don't work. My previous graphs are working correctly.
Regards,
- Attachments
-
- cacti.JPG (104.49 KiB) Viewed 4324 times
I am experiencing the exact same issue, attached is a text file with the Verbose query that you have asked for.
- Attachments
-
- verbose.txt
- (141.43 KiB) Downloaded 171 times
-
- Posts: 25
- Joined: Fri Jan 30, 2009 12:56 pm
I was just researching this exact same behavior.
It seems to be due to a difference in lib/snmp.php between 0.8.7b and 0.8.7c:
If you edit snmp.php and undo the following change:
it starts working again.
It seems to be due to a difference in lib/snmp.php between 0.8.7b and 0.8.7c:
Code: Select all
[asegura@host html]$ ls -alF; diff *-*/lib/snmp.php
total 24K
drwxr-xr-x 4 root root 4.0K Feb 3 14:20 ./
drwxr-xr-x 7 root root 4.0K Jan 15 2008 ../
lrwxrwxrwx 1 root root 13 Feb 3 14:20 cacti -> cacti-0.8.7c//
drwxr-xr-x 12 cactiuser nagios 4.0K Feb 3 14:14 cacti-0.8.7b/
drwxr-xr-x 13 cactiuser users 4.0K Feb 3 14:00 cacti-0.8.7c/
225c225
< function cacti_snmp_walk($hostname, $community, $oid, $version, $username, $password, $auth_proto, $priv_pass, $priv_proto, $context, $port = 161, $timeout = 500, $retries = 0, $environ = SNMP_POLLER) {
---
> function cacti_snmp_walk($hostname, $community, $oid, $version, $username, $password, $auth_proto, $priv_pass, $priv_proto, $context, $port = 161, $timeout = 500, $retries = 0, $max_oids = 10, $environ = SNMP_POLLER) {
227a228
> $snmp_auth = '';
314,315c315,316
< if (file_exists($path_snmpbulkwalk) && ($version > 1)) {
< $temp_array = exec_into_array($path_snmpbulkwalk . " -O Qn $snmp_auth -v $version -t $timeout -r $retries -Cr50 $hostname:$port $oid");
---
> if (file_exists($path_snmpbulkwalk) && ($version > 1) && ($max_oids > 1)) {
> $temp_array = exec_into_array($path_snmpbulkwalk . " -O Qn $snmp_auth -v $version -t $timeout -r $retries -Cr$max_oids $hostname:$port $oid");
341c342
< $string = trim(ereg_replace(".*= ?", "", $string));
---
> $string = trim(substr($string, strpos($string, " = ")));
348a350,351
> $string = str_replace("\n", " ", $string);
> $string = str_replace("\r", " ", $string);
Code: Select all
341c342
< $string = trim(ereg_replace(".*= ?", "", $string));
---
> $string = trim(substr($string, strpos($string, " = ")));
-
- Posts: 25
- Joined: Fri Jan 30, 2009 12:56 pm
-
- Posts: 25
- Joined: Fri Jan 30, 2009 12:56 pm
Confirming the bug, and the fix does resolve the issue for me.
Running OpenSolaris 2008.11 with the AMP suite installed.
PHP 5.2.6 (cli) (built: Oct 14 2008 02:53:59)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
Net-SNMP
5.0.9
OpenSolaris still ships an old Net-SNMP, not sure why.
Running OpenSolaris 2008.11 with the AMP suite installed.
PHP 5.2.6 (cli) (built: Oct 14 2008 02:53:59)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
Net-SNMP
5.0.9
OpenSolaris still ships an old Net-SNMP, not sure why.
Other versions, same bug.
Ubuntu jeos - up to date 8.04
tom@kanga:/home/cacti/cacti-0.8.7c/lib$ snmpwalk -Version
NET-SNMP version: 5.4.1
tom@kanga:/home/cacti/cacti-0.8.7c/lib$ php -v
PHP 5.2.4-2ubuntu5.4 with Suhosin-Patch 0.9.6.2 (cli) (built: Nov 25 2008 22:10:31)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
tom@kanga:/home/cacti/cacti-0.8.7c/lib$
following solution works:
Ubuntu jeos - up to date 8.04
tom@kanga:/home/cacti/cacti-0.8.7c/lib$ snmpwalk -Version
NET-SNMP version: 5.4.1
tom@kanga:/home/cacti/cacti-0.8.7c/lib$ php -v
PHP 5.2.4-2ubuntu5.4 with Suhosin-Patch 0.9.6.2 (cli) (built: Nov 25 2008 22:10:31)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
tom@kanga:/home/cacti/cacti-0.8.7c/lib$
following solution works:
If you edit snmp.php and undo the following change:Code: Select all
341c342 < $string = trim(ereg_replace(".*= ?", "", $string)); --- > $string = trim(substr($string, strpos($string, " = ")));
Who is online
Users browsing this forum: No registered users and 2 guests