cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2183
Views
0
Helpful
6
Replies

TCL SNMP send data

peraocompany
Level 1
Level 1

                   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

Joe Clarke
Cisco Employee
Cisco Employee

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 ..."

View solution in original post

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.

View solution in original post

6 Replies 6

Joe Clarke
Cisco Employee
Cisco Employee

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 ..."

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"

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.

Thenk you Joseph, it work as need.

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

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.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: