Re: Problem with SNMP-browser

Juergen Schoenwaelder (schoenw@ibr.cs.tu-bs.de)
Mon, 21 Aug 1995 12:30:24 +0200

Hi!

Joergen Haegg <jh@axis.se> said:

Joergen> tkined 1.3.3

Joergen> I try to edit a snmp variable thru MIB-2/system/edit
Joergen> system (MIB-2). But I get this errormessage. Anyone
Joergen> know why?

I do. Below is a diff that should fix this problem.

Juergen

diff -c scotty-2.0.0/tkined/library.tcl tkined/library.tcl
*** scotty-2.0.0/tkined/library.tcl Mon Jul 31 14:08:29 1995
--- tkined/library.tcl Tue Aug 15 01:12:04 1995
***************
*** 721,728 ****
## SnmpInit { toolname }
## SnmpParameter
## SnmpOpen { ip }
! ## SnmpEditScalars { ip path }
! ## SnmpEditTable {ip table }
##
## =========================================================================
##
--- 721,728 ----
## SnmpInit { toolname }
## SnmpParameter
## SnmpOpen { ip }
! ## SnmpEditScalars { s path }
! ## SnmpEditTable { s table }
##
## =========================================================================
##
***************
*** 911,922 ****
## Edit some MIB scalars.
##

! proc SnmpEditScalars {ip path} {

if {[catch {nslook $ip} host]} { set host "" }
set host [lindex $host 0]

- set s [SnmpOpen $id $ip]
foreach suc [mib successor $path] {
set access [mib access $suc]
if {[string match *write* $access]} {
--- 911,922 ----
## Edit some MIB scalars.
##

! proc SnmpEditScalars {s path} {

+ set ip [SNMPGetIP $s]
if {[catch {nslook $ip} host]} { set host "" }
set host [lindex $host 0]

foreach suc [mib successor $path] {
set access [mib access $suc]
if {[string match *write* $access]} {
***************
*** 926,939 ****
}
}
if {![info exists varlist]} {
- $s destroy
return
}

set result [ined request "Edit SNMP scalars ($path) on $host \[$ip\]:" \
$varlist [list "set scalars" cancel] ]
if {[lindex $result 0] == "cancel"} {
- $s destroy
return
}

--- 926,937 ----
***************
*** 947,967 ****
ined acknowledge "Set on [mib name $oid] failed: " "" $err
}
}
-
- $s destroy
}

##
## Edit a MIB table.
##

! proc SnmpEditTable {ip table args} {

if {[catch {nslook $ip} host]} { set host "" }
set host [lindex $host 0]
set tablename [mib name $table]

- set s [SnmpOpen $id $ip]
set list ""
if {[catch {
$s walk x [lindex [mib successor [mib successor $table]] 0] {
--- 945,963 ----
ined acknowledge "Set on [mib name $oid] failed: " "" $err
}
}
}

##
## Edit a MIB table.
##

! proc SnmpEditTable {s table args} {

+ set ip [SNMPGetIP $s]
if {[catch {nslook $ip} host]} { set host "" }
set host [lindex $host 0]
set tablename [mib name $table]

set list ""
if {[catch {
$s walk x [lindex [mib successor [mib successor $table]] 0] {
***************
*** 976,992 ****
}
} error]} {
ined acknowledge "Failed to retrieve $tablename:" "" $error
- $s destroy
return
}
if {$list == ""} {
- $s destroy
return
}

set result [ined list "Select a row to edit:" $list [list edit cancel]]
if {[lindex $result 0] == "cancel"} {
- $s destroy
return
}

--- 972,985 ----
***************
*** 1020,1026 ****
}
}
}
-
- $s destroy
}

--- 1013,1017 ----
diff -c scotty-2.0.0/tkined/snmp_browser.tcl tkined/snmp_browser.tcl
*** scotty-2.0.0/tkined/snmp_browser.tcl Fri Jul 28 20:02:37 1995
--- tkined/snmp_browser.tcl Tue Aug 15 00:53:58 1995
***************
*** 281,287 ****

proc EditScalars {list group} {
ForeachIpNode id ip host $list {
! SnmpEditScalars $ip $group
}
}

--- 281,289 ----

proc EditScalars {list group} {
ForeachIpNode id ip host $list {
! set s [SnmpOpen $id $ip]
! SnmpEditScalars $s $group
! $s destroy
}
}

***************
*** 303,309 ****

proc EditTable {list table args} {
ForeachIpNode id ip host $list {
! SnmpEditTable $ip $table $args
}
}

--- 305,313 ----

proc EditTable {list table args} {
ForeachIpNode id ip host $list {
! set s [SnmpOpen $id $ip]
! SnmpEditTable $s $table $args
! $s destroy
}
}