Re: Snmpget in net-snmp 5.2.1 hangs on windows 2003

Alex Burger <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
Hi Jim.

Mohr James wrote:
> In order to record performance data, we have a construct that looks like
> this:
> 
> - Nagios starts an NRPE job on another machine which starts a perl
> script on a Windows 2003 machine
> - the perl script uses the snmpget command from net-snmp 5.2.1 to read a
> single value from a remote machine. 
> - The value is set in the perl script simply by $value=`$command`. (I am
> not using the SNMP perl modules)
> -  The OID .1.3.6.1.4.1.1.1.101.1 is defined like this in snmpd.conf: 
> exec .1.3.6.1.4.1.1.1 /usr/bin/perl /opt/elaxy/bin/get_cpu_usage.pl
> - This value is then written to a MS SQL Database using osql. 
> 
> What is happening is that I see dozens of snmpget.exe programms running
> (occassionally a couple of perl.exe processes). Unfortunately, I see no
> way of figuring out to where these processes are connected, so I cannot
> tell if there are specific machine causing the problems. Using netstat,
> I do see a number of connections to the MS SQL database in TIMEWAIT.
> However, since we are checking a couple of dozens machines, this is not
> surprising. 
> 
> The Nagios is reporting both "CHECK_NRPE: Socket timeout after 10
> seconds." and "connection refused". Obviously this could be a purely
> Nagios problem, however, as far as I can see it seems to be behaving
> correctly. Plus, we have the dozens of snmpget processes that do not go
> away. 

Do the snmpget.exe commands eventually disappear?

I suspect the timeouts are because snmpget is taking too long to 
respond, probably because of a bad community string.  The agent won't 
respond with a 'wrong community string'.  The client just keeps trying 
until the timeout occurs.  I'm not sure about the "connection refused" 
errors.

The default timeout for snmpget (and other commands) is 1 second, and 
the default retries is 5 (man snmpcmd).  Try reducing the retries to 2 
using '-r 2'.

Snmpget errors are sent to STDERR.  To include STDERR in the result, use 
$value=`$command 2>&1`;

If you want to handle the errors by exit code, you can capture it from 
the command using:

$value=`$command`;
$errorlevel = $? >> 8;

Alex



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.