cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1307
Views
0
Helpful
1
Replies

Snmp-notification varbinds access

Hello,

The command

show event manager detector snmp-notification detailed

shows me a lot of accessible variables like a $_event_id or $_snmp_notif_oid.

Applet Built-in Environment Variables: 
$_event_id
$_job_id
$_event_type
$_event_type_string
$_event_pub_time
$_event_pub_sec
$_event_pub_msec
$_event_severity
$_snmp_notif_oid
$_snmp_notif_oid_val
$_snmp_notif_src_ip_addr
$_snmp_notif_dest_ip_addr
$_x_x_x_x_x_x (varbinds)
$_snmp_notif_trap_oid
$_snmp_notif_ent_oid
$_snmp_notif_gen_trap
$_snmp_notif_spec_trap

Among them are we can see some $_x_x_x_x_x_x (varbinds) environment variables, if I understand correctly its a dynamically created variables which includes SNMP PDU varbinds. How can I get access to this variables from my TCL\applet? I didn’t found any information about it from public manuals.

Many thanks for any help!

1 Accepted Solution

Accepted Solutions

Joe Clarke
Cisco Employee
Cisco Employee

Yes, they are dynamically created based on the varbinds, but they are almost impossible to access from applets since you have to know the full varbind (including any instance values).  Because of this, I use Tcl for any policies in which I need to access varbind details like this.  Here is a Tcl example of accessing the varbind variables:

array set arr_einfo [event_reqinfo]

set vb {}
foreach key [array names arr_einfo] {
    if { [regexp {1_3_6_1_4_1_9_10_91_1_2_3_1_11_} $key] } {
        set vb $key
        break
    }
}

View solution in original post

1 Reply 1

Joe Clarke
Cisco Employee
Cisco Employee

Yes, they are dynamically created based on the varbinds, but they are almost impossible to access from applets since you have to know the full varbind (including any instance values).  Because of this, I use Tcl for any policies in which I need to access varbind details like this.  Here is a Tcl example of accessing the varbind variables:

array set arr_einfo [event_reqinfo]

set vb {}
foreach key [array names arr_einfo] {
    if { [regexp {1_3_6_1_4_1_9_10_91_1_2_3_1_11_} $key] } {
        set vb $key
        break
    }
}

Review Cisco Networking for a $25 gift card