Page 1 of 1

SNMP-Walk wizard does not allow port number

Posted: Mon May 21, 2012 10:23 am
by cscholz
A server is running on a non-stanard SNMP port, and we need to use the wizard to walk the device. It's running on port 4000, but the wizard does not offer a way to specify port number.

Can someone point me to the file to hack so I can add in this missing feature? Failing that, can someone at Nagios push out an alpha or beta wizard with a fix soon? This is fairly important as we have an entire class of servers running one of our primary products coming online in the coming weeks.

The /usr/local/nagios/libexec/check_snmp script takes a port number, so the walk wizard should too.

Thanks.

Re: SNMP-Walk wizard does not allow port number

Posted: Mon May 21, 2012 10:40 am
by nscott
Around line 757 of /usr/local/nagiosxi/html/includes/configwizards/snmpwalk/snmpwalk.inc.php edit in this snippet

It won't put anything in the wizard, but this will have the wizard make commands that add -p 4000 to every command it spits out.

Code: Select all

$cmdargs="";
$cmdargs=" -p 4000 ";  /// <--- THIS IS THE LINE YOU WANT, NOTE THE SPACES
// oid
if($oid!="")
    $cmdargs.=" -o ".$oid;
// snmp community
if($snmpcommunity!="")
    $cmdargs.=" -C ".$snmpcommunity;
// snmp version
if($snmpversion!="")
    $cmdargs.=" -P ".$snmpversion;
// snmp v3 stuff
if($snmpversion=="3"){
I'll have a look at getting the option added to wizard, but this fix should work for you in the short term.

Re: SNMP-Walk wizard does not allow port number

Posted: Mon May 21, 2012 10:58 am
by nscott
Actually, I just did the editing, would you mind giving this a go, it worked for my intial tests, but if you wouldn't mind testing this out, it should support port numbers now:

Re: SNMP-Walk wizard does not allow port number

Posted: Mon May 21, 2012 11:03 am
by cscholz
Looks good so far - thanks for the quick turnaround. Big help!

Re: SNMP-Walk wizard does not allow port number

Posted: Mon May 21, 2012 11:08 am
by nscott
csholz,

Yeah be sure to me know how it goes, if it works without a hiccup for you this will replace the current snmpwalk wizard.

Re: SNMP-Walk wizard does not allow port number

Posted: Mon May 21, 2012 11:11 am
by cscholz
nscott wrote:csholz,

Yeah be sure to me know how it goes, if it works without a hiccup for you this will replace the current snmpwalk wizard.
Seems to not return all of the available OIDs. I'm searching under MIB mgmt.1337, and I'm only getting 6 results. The limit is set to 100. I know for a fact that mgmt.1337.43.0 is a valid oid for this host. Any idea what might be happening?

Re: SNMP-Walk wizard does not allow port number

Posted: Mon May 21, 2012 11:21 am
by nscott
On the command line, if you do an snmpwalk on that MIB, do you get more than 6 results?

Re: SNMP-Walk wizard does not allow port number

Posted: Mon May 21, 2012 11:28 am
by cscholz
nscott wrote:On the command line, if you do an snmpwalk on that MIB, do you get more than 6 results?
That should have been the first thing I tried - lapse on my part. There is an issue with the SNMP agent on the other side, returning an error after 1337.6.0. Thanks for bearing with me. So far, the tool is working as expected in this case. :oops:

Re: SNMP-Walk wizard does not allow port number

Posted: Mon May 21, 2012 11:41 am
by nscott
Hey no problem cscholz ;), let me know how it goes.