cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2580
Views
0
Helpful
7
Replies

EEM Applet -- Can you set an Env Var from an Applet?

tproeber
Level 1
Level 1

The 900MhzTX Environment Variable is not getting set.  I'm trying to constantly display the radio data rates in the Sho-Run.  After this works I'll add for the RX and for the other 3 radios.

It runs successfully but doesn't set the Env Var.


event manager applet Radio-Reader

event timer watchdog time 10

action 010 cli command "enable"

action 020 cli command "ssh -l ubnt 192.168.2.11" pattern "assword:"

action 030 cli command "fly2the*" pattern "#"

action 040 cli command "mca-status" pattern "#"

action 050 regexp "wlanTxRate=([0-9\.]+)" $_cli_result

action 060 set 900MhzTX $_cli_result

action 070 cli command "config t" pattern "#"

action 080 cli command "event manager environment 900MhzTX $900MhzTX" pattern "#"

action 090 cli command "exit" pattern "#"

action 100 cli command "exit" pattern "#"

Thanks,

Tim

7 Replies 7

Joe Clarke
Cisco Employee
Cisco Employee

This looks wrong.  Perhaps you mean:

action 050 regexp "wlanTxRate=([0-9\.]+)" $_cli_result match txrate

action 060 set 900MhzTX $txrate

! Here you need to disconnect from the radio before you can configure anything on the router

action XXX cli command "config t"

...

Thanks!  I'm zeroing in on the solution!

Is the "match txrate" part of the command --or a note by you?


Part of the command.

Sorry, I see the txrate is the var.

Tim

The Applet works but gets an error after successfully working:

event manager environment 900_TX 240

event manager directory user policy "flash:/"

event manager applet Radio-Reader

event timer watchdog time 10

action 010 cli command "enable"

action 020 cli command "ssh -l ubnt 192.168.2.11" pattern "assword:"

action 030 cli command "fly2the*" pattern "#"

action 040 cli command "mca-status" pattern "#"

action 050 regexp "wlanTxRate=([0-9]+)" "$_cli_result" match txrate

action 070 cli command "exit" pattern "#"

action 080 cli command "config t" pattern "#"

action 090 cli command "event manager environment 900_TX $txrate" pattern "#"

action 100 cli command "exit" pattern "#"

action 110 cli command "exit" pattern "#"

*Nov 26 12:05:58 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT : 2901_Rig_1>

*Nov 26 12:05:58 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : IN  : 2901_Rig_1>enable

*Nov 26 12:05:58 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT : 2901_Rig_1#

*Nov 26 12:05:58 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : IN  : 2901_Rig_1#ssh -l ubnt 192.168.2.11

*Nov 26 12:05:58 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : CTL : cli_close called.

*Nov 26 12:05:58 UTC:

*Nov 26 12:05:58 UTC: tty is now going through its death sequence

*Nov 26 12:05:58 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT : Password:

*Nov 26 12:05:58 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : IN  : fly2the*

*Nov 26 12:05:58 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT :

*Nov 26 12:05:58 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT :

*Nov 26 12:05:58 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT : BusyBox v1.11.2 (2013-05-28 17:52:06 EEST) built-in shell (ash)

*Nov 26 12:05:58 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT : Enter 'help' for a list of built-in commands.

*Nov 26 12:05:58 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT :

*Nov 26 12:05:58 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT : XM.v5.5.6#

*Nov 26 12:05:58 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : IN  : mca-status

*Nov 26 12:05:59 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT : mca-status

*Nov 26 12:05:59 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT : deviceName=2.4_AP.11,deviceId=DC:9F:DB:6A:A2:17,firmwareVersion=XM.ar7240.v5.5.6.17762.130528.1755,platform=Rocket M2,deviceIp=192.168.2.11

*Nov 26 12:05:59 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT :

*Nov 26 12:05:59 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT : apMac=DC:9F:DB:6A:A2:17

*Nov 26 12:05:59 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT : wlanOpmode=ap

*Nov 26 12:05:59 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT : wlanConnections=3

*Nov 26 12:05:59 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT : wlanUptime=1563423

*Nov 26 12:05:59 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT : essid=2400

*Nov 26 12:05:59 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT : freq=2429

*Nov 26 12:05:59 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT : signal=-40

*Nov 26 12:05:59 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT : noise=-89

*Nov 26 12:05:59 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT : ccq=983

*Nov 26 12:05:59 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT : uptime=1563423

*Nov 26 12:05:59 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT : loadavg=0

*Nov 26 12:05:59 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT : memTotal=62012

*Nov 26 12:05:59 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT : memFree=42976

*Nov 26 12:05:59 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT : memBuffers=2340

*Nov 26 12:05:59 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT : ackTimeout=24

*Nov 26 12:05:59 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT : distance=0

*Nov 26 12:05:59 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT : lanIpAddress=0.0.0.0

*Nov 26 12:05:59 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : CTL : 20+ lines read from cli, debug output truncated

*Nov 26 12:05:59 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : IN  : exit

*Nov 26 12:06:00 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT : exit

*Nov 26 12:06:00 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT :

*Nov 26 12:06:00 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT : [Connection to 192.168.2.11 closed by foreign host]

*Nov 26 12:06:00 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT : 2901_Rig_1#

*Nov 26 12:06:00 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : IN  : config t

*Nov 26 12:06:00 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT : config t

*Nov 26 12:06:00 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT : Enter configuration commands, one per line.  End with CNTL/Z.

*Nov 26 12:06:00 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT : 2901_Rig_1(config)#

*Nov 26 12:06:00 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : IN  : event manager environment 900_TX 240

*Nov 26 12:06:00 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT : event manager environment 900_TX 240

*Nov 26 12:06:00 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT : 2901_Rig_1(config)#

*Nov 26 12:06:00 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : IN  : exit

*Nov 26 12:06:00 UTC: %SYS-5-CONFIG_I: Configured from console by  on vty3 (EEM:Radio-Reader)

*Nov 26 12:06:00 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT : exit

*Nov 26 12:06:00 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : OUT : 2901_Rig_1#

*Nov 26 12:06:00 UTC: %HA_EM-6-LOG: Radio-Reader : DEBUG(cli_lib) : : IN  : exit

2901_Rig_1#

2901_Rig_1#

2901_Rig_1#

2901_Rig_1#term no mon

2901_Rig_1#

2901_Rig_1#

2901_Rig_1#

2901_Rig_1#un all

All possible debugging has been turned off

2901_Rig_1#

2901_Rig_1#

2901_Rig_1#sho eve man his eve

No.  Job Id Proc Status   Time of Event            Event Type        Name

1    24     Actv abort    Tue Nov26 12:04:48 2013  timer watchdog    applet: Radio-Reader

2    25     Actv abort    Tue Nov26 12:04:58 2013  timer watchdog    applet: Radio-Reader

3    26     Actv abort    Tue Nov26 12:05:08 2013  timer watchdog    applet: Radio-Reader

4    27     Actv abort    Tue Nov26 12:05:18 2013  timer watchdog    applet: Radio-Reader

5    28     Actv abort    Tue Nov26 12:05:28 2013  timer watchdog    applet: Radio-Reader

6    29     Actv abort    Tue Nov26 12:05:38 2013  timer watchdog    applet: Radio-Reader

7    30     Actv abort    Tue Nov26 12:05:48 2013  timer watchdog    applet: Radio-Reader

8    31     Actv abort    Tue Nov26 12:05:58 2013  timer watchdog    applet: Radio-Reader

9    32     Actv abort    Tue Nov26 12:06:08 2013  timer watchdog    applet: Radio-Reader

10   33     Actv abort    Tue Nov26 12:06:18 2013  timer watchdog    applet: Radio-Reader

2901_Rig_1#

Thanks,

Tim

What error?  The only issue I see is that after you disconnect from your radio, you no longer need to use "pattern" with your CLI commands.  The default prompt of the device will be auto-matched.

Yes, it was just the last "#". 

I think I'm on my way now.

Thanks!

Tim

Review Cisco Networking for a $25 gift card