This is my first message in this forum, so please excuse me if I created a wrong or repeated thread.
I've been facing a really tricky problem, concerning the SNMP platform and more specifically it's Timing Out. I have already searched for answers and solutions but nothing seems to help me.
I have the following system :
One remote PC (Debian) runs an SNMP Daemon with an snmp agent (SNMP Version : 2).
The agent listens for "get" requests on a certain OID of a MIB I created.
When he receives a "get" request for this OID, he sleeps for 10 seconds and then returns a "0". All codes are implemented in C.
Another PC (Debian) runs an Python SNMP Client that runs snmpget to that OID.
The reason I created the above system is to test the Timeout of the client.
The results have come out badly. The Daemon sleeps for 10 seconds, while the Python Client times out in 6 seconds.
I have tried setting the client's request as follows:
netsnmp.snmpget(trigger_oid, Version = ConfSNMPVersion, DestHost= ConfDemonHost, Community= ConfCommunityName, Timeout = 150000000, Retries = 1000)
telling the client to wait for 150 seconds and run 1000 retries in case of a failure. No matter how big or small intervals do I set, the client ALWAYS times out in 6 seconds.
Here is the output of my Python Client at some point of the execution :
time python get_sleepy_oid.py
Getting SNMP configuration...
Triggering Active Measurements Information...
150000000 //this is the timeout interval
1000 //this is the retries count
Waiting for Sleepy OID...
I have also tried to run a Command Line snmpget, for example :
snmpget -v2c -c public remotedebian -r 500 -t 10000000 .18.104.22.168.4.1.8072.2.5.1.1.12.0
And again, it times out.
Do you have any clue on how to solve the above problem?
I REALLY need the SNMP agent on the Demon pc to execute some things for several seconds (even more than 10) but I can't have the client to time out so quickly...
ANY insight on this issue will be greatly appreciated!!!
Not much help, but have you tried to run ie 'tcpdump' with appropreate options on both server and client to see what happends when the snmp-request is run?
Do you get an answer to the client if you remove the sleep from the server, or if you set sleep to < 6 sec?
very strange - I'm still using the following SNMP Module from Simon Leinen within Perl for several years now:
64.2 KB - all explanations and examples are included in the gz file - easy to use + with all parameters to adjust what I need,
but I never had this kind of problem.
1. SNMP is UDP (sessionless) ==> is a connection always possible and given during the whole request ?
= start an ICMP PING continuously during your action, just to verify that not the OS is raising an event that something is happening like your used IP port is going down (maybe only for a short time) and due to that is influencing your whole application !
2. It looks like your PC running ANY SNMP client has a problem, because the used SNMP application does not matter.
also in use by me and would be very helpful: free SNMP MIB Browsers like
ks-soft.net/hostmon.eng/mibbrowser/index.htm (no installation needed)
to use a total different OS (like MS Windows)
Hello and thank you all for the replies.
I tried everything (netstat, wireshark, tutorials and so on and so forth) and nothing helped.
The moment my brains started to melt down, I found the solution!!!
I'm gonna post it here in case someone else faces this problem.
As I said I had :
1. A Python Client
2. An SNMP Daemon
3. A Master Agent (since I created a MIB of my own)
Setting the Timeout and Retries on the Client did not work.
Setting the Timeout on the SNMP Daemon did not work.
Setting the Timeouts on both of the above, did not work.
Every freakin' time, the Client timed out in 6 seconds.
So, I started digging the guts of all the source codes and realized that, that snicky, undocumented little bastard, AgentX, has Timeouts too!
You can see some defined timeout times in the .../snmplib/snmp_client.c code.
So I realized that :
When the Client connects to the SNMP Daemon, it exchanges protocol information NOT with the Daemon itself but with the Master Agent!
And it was the Master Agent that was telling my Client to Timeout in 6 seconds no matter what!
(At least, this is my explanation. I didn't find any soluction in the net, so I imagine that this is what happens. I could be wrong, ofcourse.)
So, the solution is :
1. I set the Agent's time out
Went to the SNMP Config file (net-snmp-config --snmpconfpath) and added the following lines:
agentXTimeout 60 #60 seconds = 1 minute
agentXRetries 10 #10 retries of 1 minute each => 1 hour timeout. Seems legit :p
2. Set the Clients time out
netsnmp.snmpget(trigger_oid, Version = ConfSNMPVersion, DestHost= ConfDemonHost, Community= ConfCommunityName, Timeout = 360000000, Retries = 10)
And it worked!
Note that you should set large timeouts for BOTH the AgentX and the Client. If you set only the AgentX's and leave the Client with it's default values, it will timeout way before the AgentX manages to send the answer.
So, by setting my Client and AgentX in the way shown, I solved the problem and now the AgentX does some work for 15 seconds and replies to the Client that waits politely!
Tah dah !!!