Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Possible problem with GetBulk within threads ??

1 view
Skip to first unread message

Djc

unread,
Mar 4, 2005, 9:15:57 AM3/4/05
to

Hello everyone,

Im a tad new to SNMP GetBulk, but have discovered an interesting
feature when used within threads.

What Im doing is using multiple threads to do SNMP getbulks. I have
one thread per IpAddress, and Ive had to create an SNMP handle within
each one. The actual code is more complex, but im using a simple
example.

The behaviour Im observing is this:

1)first, an SNMP GetBulk is successfully performed on an IpAddress
(with a SNMP daemon running) and the data is returned.. thats ok.
2)an SNMP GetBulk is apparently successfully performed on an IpAddress
(without a SNMP daemon running) because the data is still returned.
(By the way, regardless of the info requested in the second getbulk,
the data returned is the same as the first getbulk)
3) now, if i repeat step two, I get a No-Response message.

my question is, why doesnt it detected the error in step 2, and not in
step 3.

can someone point out my mistake please??? is there an
SNMP-flush-cache option??

For anyone who would like to reproduce this situation, try this code:
Im using Tcl/TK 8.4.9, Tnm:3.0.0 & Threads 2.6.1


Screen output
(Temp) 93 % wish84 test.tcl
10.0.1.111 ==> {1.3.6.1.2.1.1.1.0 {OCTET STRING} {Linux Zeus1
2.4.21-99-default #1 Wed Sep 24 13:30:51 UTC 2003 i686}}
{1.3.6.1.2.1.1.3.0 TimeTicks 25842754}

10.0.1.117 ==> {1.3.6.1.2.1.1.1.0 {OCTET STRING} {Linux Zeus1
2.4.21-99-default #1 Wed Sep 24 13:30:51 UTC 2003 i686}}
{1.3.6.1.2.1.1.3.0 TimeTicks 25842790}
(Temp) 93 %


# IpAddress 111 has an SNMP daemon running
# IpAddress 117 doesnt have an SNMP daemon


package require Tnm
package require Thread

proc valid {} {

set tId [thread::create {
package require Tnm
set tnm(mibs) ""
set snmp [Tnm::snmp generator -address 10.0.1.111 -timeout 2
-retries 5]
set txt [$snmp getbulk 0 1 "sysDescr sysUpTime" ]
puts "[$snmp cget -address] ==> $txt"
puts ""
thread::wait
}]
return $tId
}

proc not_valid {} {

set tId [thread::create {
package require Tnm
set tnm(mibs) ""
set snmp [Tnm::snmp generator -address 10.0.1.117 -timeout 2
-retries 5]
set txt [$snmp getbulk 0 1 "sysName sysContact" ]
puts "[$snmp cget -address] ==> $txt"
thread::wait
}]
return $tId
}

after 3000
valid

after 3000
not_valid

############
# error is passed back now
#
#after 3000
#not_valid

after 3000 {exit}

0 new messages