Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

TCL SNMP send data

                   Hello I need some help with my problem.

My Cisco device comunicate over SNMP, I need sens spetial data over SMS, and see way but try do it more good.

Switch_1 (Send $data over TCL and SNMP)

if [catch {action_snmp_trap intdata1 "424242" strdata "$data"} result] {

error $result $errorInfo

} else {

action_syslog msg "SNMP sent"}

Switch_2 (recieve SNMP message and must send it to Cellular int.)

event manager applet SNMP

event snmp-notification oid 1.3.6.1.4.1.9.10.91.1.2.3.1.9. oid-val "424242" op eq src-ip-address xxx.xxx.xxx.xxx

action 10 cellular 0/0/1 gsm sms send 8xxxxxxxxxx "$data"

I try know can EEM get strdada from SNMP, and put it to next action command? Than you.

2 ACCEPTED SOLUTIONS

Accepted Solutions
Cisco Employee

TCL SNMP send data

I think what you're asking is what the variable name is to get strdata?  If that is the case, this is very difficult to do with applets.  However, if you look at https://supportforums.cisco.com/docs/DOC-11745 you'll find instructions on sending a purely customized trap using EEM.  If you use those steps, you can build your own varbind such as 1.3.6.1.4.1.33333.1.2.0 with your custom data.  Then, in your receiving applet, you can do:

action 1.0 set data $_1_3_6_1_4_1_33333_1_2_0

action 2.0 cli command "cellular ..."

Cisco Employee

TCL SNMP send data

You will still need a varbind with a predictable value on which to match.  So add another varbind like 1.3.6.1.4.1.33333.1.0 with a number value that doesn't change.  Then match on that in your event detector line.

6 REPLIES
Cisco Employee

TCL SNMP send data

I think what you're asking is what the variable name is to get strdata?  If that is the case, this is very difficult to do with applets.  However, if you look at https://supportforums.cisco.com/docs/DOC-11745 you'll find instructions on sending a purely customized trap using EEM.  If you use those steps, you can build your own varbind such as 1.3.6.1.4.1.33333.1.2.0 with your custom data.  Then, in your receiving applet, you can do:

action 1.0 set data $_1_3_6_1_4_1_33333_1_2_0

action 2.0 cli command "cellular ..."

New Member

TCL SNMP send data

hello Joseph, thank you for you time. I have some dificulties with reciever config (on custom trap)

SW1:

event manager applet sw1

event syslog pattern "%SYS-5-CONFIG_I: Configured from console"

action 1.0 info type snmp var "vbinds" oid 1.3.6.1.4.1.33333.2.0 string "$data"

action 3.0 info type snmp trap enterprise-oid 1.3.6.1.4.1.33333.1 generic-trapnum 6 specific-trapnum 1 trap-oid 1.3.6.1.4.1.9.33333.1.0.1 trap-var "vbinds"

action 4.0 syslog msg "Triggered from Trap!"

SW2:

event manager applet sw2

event snmp-notification oid 1.3.6.1.4.1.33333.1 oid-val "*" op eq src-ip-address 192.168.xx.xx

action 2.0 syslog msg "$_1_3_6_1_4_1_33333_2_0"

Cisco Employee

TCL SNMP send data

You will still need a varbind with a predictable value on which to match.  So add another varbind like 1.3.6.1.4.1.33333.1.0 with a number value that doesn't change.  Then match on that in your event detector line.

New Member

TCL SNMP send data

Thenk you Joseph, it work as need.

New Member

TCL SNMP send data

Hello Joseph, can posable overwrite one OID in one script?

If I try do it, sw get error:

Aug  4 14:08:01: %HA_EM-6-LOG: sw.tcl: Duplicate oid: 1.3.6.1.4.1.33333.2.0

Aug  4 14:08:01: %HA_EM-6-LOG: sw.tcl:     while executing

Aug  4 14:08:01: %HA_EM-6-LOG: sw.tcl: "sys_reqinfo_snmp_trapvar var vbinds oid 1.3.6.1.4.1.33333.2.0 string $line "

Aug  4 14:08:01: %HA_EM-6-LOG: sw.tcl:     invoked from within

Aug  4 14:08:01: %HA_EM-6-LOG: sw.tcl: "$slave eval $Contents"

Aug  4 14:08:01: %HA_EM-6-LOG: sw.tcl:     (procedure "eval_script" line 7)

Aug  4 14:08:01: %HA_EM-6-LOG: sw.tcl:     invoked from within

Aug  4 14:08:01: %HA_EM-6-LOG: sw.tcl: "eval_script slave $scriptname"

Aug  4 14:08:01: %HA_EM-6-LOG: sw.tcl:     invoked from within

Aug  4 14:08:01: %HA_EM-6-LOG: sw.tcl: "if {$security_level == 1} {       #untrusted script

Aug  4 14:08:01: %HA_EM-6-LOG: sw.tcl:      interp create -safe slave

Aug  4 14:08:01: %HA_EM-6-LOG: sw.tcl:      interp share {} stdin slave

Aug  4 14:08:01: %HA_EM-6-LOG: sw.tcl:      interp share {} stdout slave

Aug  4 14:08:01: %HA_EM-6-LOG: sw.tcl: ..."

Aug  4 14:08:01: %HA_EM-6-LOG: sw.tcl:     (file "tmpsys:/lib/tcl/base.tcl" line 50)

Aug  4 14:08:01: %HA_EM-6-LOG: sw.tcl: Tcl policy execute failed:

Aug  4 14:08:01: %HA_EM-6-LOG: sw.tcl: Duplicate oid: 1.3.6.1.4.1.33333.2.0

Cisco Employee

TCL SNMP send data

No, this is not possible.  You should only set your varbind value when you're sure that's what you want.  If you need another value, you'll have to create a new varbind variable name.

522
Views
0
Helpful
6
Replies