PATCH: net-snmp version 5.x support

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

Moderators: Developers, Moderators

RebelYell

Re: PATCH: net-snmp version 5.x support

Post by RebelYell »

The patch went fine on my box (gentoo linux 1.4 rc1); however it seems that ignores my "-v 2c" version option.
Now it floods my apache logs with :

Code: Select all

snmpwalk: No securityName specified
Anyone could give me a hint?
Linus

Re: PATCH: net-snmp version 5.x support

Post by Linus »

I had the same problem. I ended up adding the security name manually into snmp_function.php

Code: Select all

if ("on" == $config["net_snmp_5"]["value"]) {
                        $snmp_value = exec($config["path_snmpget"]["value"] . " -v2c -c '$community' $hostname $oid");
and

Code: Select all

        }else{
                if ("on" == $config["net_snmp_5"]["value"]) {
                        $temp_array = exec_into_array($config ["path_snmpwalk"]["value"] . " -v2c -c '$community' $hostname $oid");

SirFunk

applied & in interface but no work

Post by SirFunk »

Hey, i applied the patch, and it appeared in the interface, and i added a host. However, it still doesn't work. It doesn't find any interfaces on the host... When i run php cmd.php from console, it gives no errors.. but it's not returning the interfaces? Might the problem be that is' using php snmpd? I deffinatley compiled php w/o snmp... is there a way to make sure it's not using php snmp?
Sir Funk

Post by Sir Funk »

Actually.. i just noticed, my log says:

01/14/2003 9:45 PM - SNMP: Getting SNMP data for host: 192.168.0.10, community: public, hostid: 4

does that mean snmp is working? just not returning values?
jvanhambelgium
Posts: 33
Joined: Fri Jan 10, 2003 3:16 am
Location: Antwerpen (Belgium)
Contact:

NET-SNMP Fix not really working...

Post by jvanhambelgium »

Hi,

Well, the patch is not really working on my FreeBSD machine. I'm getting just about any possible error there is to get...

cacti# patch -p0 < cacti.patch
Hmm... Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|--- ../cacti-0.6.8a.orig/cacti.sql Thu Sep 5 22:52:22 2002
|+++ cacti.sql Tue Sep 17 18:04:18 2002
--------------------------
Patching file cacti.sql using Plan A...
Hunk #1 failed at 919.
1 out of 1 hunks failed--saving rejects to cacti.sql.rej
Hmm... The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|--- ../cacti-0.6.8a.orig/settings.php Thu Sep 5 16:20:52 2002
|+++ settings.php Tue Sep 17 17:55:40 2002
--------------------------
Patching file settings.php using Plan A...
Hunk #1 failed at 91.
1 out of 1 hunks failed--saving rejects to settings.php.rej
Hmm... The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|--- ../cacti-0.6.8a.orig/include/snmp_functions.php Thu Sep 5 22:07:22 2002
|+++ include/snmp_functions.php Tue Sep 17 17:58:43 2002
--------------------------
Patching file include/snmp_functions.php using Plan A...
Hunk #1 failed at 26.
Hunk #2 failed at 57.
Hunk #3 failed at 85.
Hunk #4 failed at 254.
4 out of 4 hunks failed--saving rejects to include/snmp_functions.php.rej
Hmm... The next patch looks like a unified diff to me...
The text leading up to this was:
--------------------------
|--- ../cacti-0.6.8a.orig/include/version_functions.php Thu Sep 5 16:20:52 2002
|+++ include/version_functions.php Tue Sep 17 18:03:58 2002
--------------------------
Patching file include/version_functions.php using Plan A...
patch: **** malformed patch at line 98: \ No newline at end of file
cacti#



Anyone with cacti running on FreeBSD with NET-SNMP 5.x cares to provide me with their updated files ??? You can find my coordinates....
As workaround, I'm compiling 4.x train of UCD-SNMP ... suppose that will work...


Best regards,
jan
"Never Trust A Computer You Can't Throw Out A Window" - Steve Wozniak
cory
Posts: 1
Joined: Mon Feb 10, 2003 12:57 pm
Location: Calgary, Alberta Canada

NET-SNMP Fix not really working

Post by cory »

This is what I did to make it work:

- Redhat 8.0
- apache-2.44 compiled with php 4.3.0 (not rpms)
- net-snmp-5.0.6-8.80.2 rpm
- installed cacti-0.6.8a
- ran the cacti-0.6.8a-net-snmp-5.patch.txt
- ran the manual SQL commands listed earlier in the thread against my cacti database

-- then I noticed I was still getting "snmpwalk: No securityName specified" in my apache logs.

-- I then hardcoded the "-v 2c" into include/snmp_functions.

if ("on" == $config["net_snmp_5"]["value"]) {
$temp_array = exec_into_array($config["path_snmpwalk"]["value"] . " -v 2c -c '$community' $hostname $oid");^M
} else {
$temp_array = exec_into_array($config["path_snmpwalk"]["value"] . " -v 1 $hostname '$community' $oid");^M
}

-- When I refreshed my snmp interfaces, it took much longer after making this change. (The SNMP walk was running).. When it completed it displayed the correct interface information.

Hope this helps.
Cory
blaine

Post by blaine »

the web-based version configuration box should work. Make sure you don't quote your version string. Just the bare
-v 2c
or
-v 1

--
blaine@binary.net
Guest

Post by Guest »

From My experience with this patch you still run into one problem. At the start of the
snmp_functions.php the below function is called, but falls out of scope before line 91 can use it, On mine I added the following, starting at line 77 and $force_version now gets pull from mysql and is used, hince making anything in the "Optional SNMP version string" to be add to the snmpwalk string.


77 if ("" != $config["net_snmp_version"]) {
78 $force_version = $config["net_snmp_version"]["value"];
79 }


91 $temp_array = exec_into_array($config["path_snmpwalk"]["value"] . " $force_version -c '$community' $hostname $oid")

But Hey, I am not a php "expert", so verify for your self...

Also as any fyi, How I tested was to add the below to line 93 so I could see the snmpwalk command output:

$filehandle = fopen("/tmp/temparray.txt", "w+");
fwrite($filehandle, $config["path_snmpwalk"]["value"] . " $force_version -c '$community' $hostname $oid");

Just touch and chmod 777 /tmp/temparray.txt

I haven't completed the testing of the rest of cacti to see if this happens to snmpget...

Bryan
Andreas

missing chunk in that patch

Post by Andreas »

you also need to add the force_version check to cacti_snmp_walk. Add this somewhere in that function.
if ("" != $config["net_snmp_version"]) {
$force_version = $config["net_snmp_version"]["value"];
}
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests