cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1305
Views
0
Helpful
2
Replies

sys_reqinfo_snmp response vs. response from cli snmp get v2

Levi Iiams
Level 1
Level 1

When I run the following, I get the RSSI return I expect:

#snmp get v2c 172.16.11.2 public oid 1.3.6.1.4.1.9.9.661.1.3.4.1.1.1.13

SNMP Response: reqid 47, errstat 0, erridx 0
c3gCurrentGsmRssi.13 = -59

But my tcl script, below, returns something completely different, and I can't work out why!

It returns:  

#ev m run rssitest.tcl
4294967238

Do I need to parse the $result somehow?  If so, how???

::cisco::eem::event_register_none
namespace import ::cisco::eem::*
namespace import ::cisco::lib::*
set rssi 0
if [info exists rssi] {
if [catch {sys_reqinfo_snmp oid 1.3.6.1.4.1.9.9.661.1.3.4.1.1.1.13 get_type exact} result] {
error $result $errorinfo
}
} else {
puts Cannot do snmp query, because... reasons!
} array set snmp_res $result
set rssi $snmp_res(value)
puts $rssi

1 Accepted Solution

Accepted Solutions

Joe Clarke
Cisco Employee
Cisco Employee

This is a side effect of signed versus unsigned integers.  EEM Tcl is casting the value to an unsigned integer.  To get the signed value, do:

set rssi [expr  ($snmp_res(value) - 4294967295) - 2]

View solution in original post

2 Replies 2

Joe Clarke
Cisco Employee
Cisco Employee

This is a side effect of signed versus unsigned integers.  EEM Tcl is casting the value to an unsigned integer.  To get the signed value, do:

set rssi [expr  ($snmp_res(value) - 4294967295) - 2]

Levi Iiams
Level 1
Level 1

Sir - I knew 1) you'd be the one to answer and 2) you'd have the answer.

Course... it's a simple one, but still... :P

Thanks!!!

Review Cisco Networking for a $25 gift card