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

Applet - Load command results into a variable -- and then post as Env Variable?

Here I SSH into a radio and do the "mca-status" command.  It has a long output that gets truncated bfore it displays the items that I need to extract.  What's the best way to do this?

And then I also want to post the results as a sho-run environment variable .  .

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]{1,3}" "$_cli_result"

action 060 set 900MhzTX "$_regexp_result"

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

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

action 080 cli command "exit" pattern "#"

2901_Ship_4#

*Nov 22 10:46:07 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : CTL : cli_open called.

*Nov 22 10:46:07 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT : CC

*Nov 22 10:46:07 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT : NOTICE TO USERS

*Nov 22 10:46:07 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT :                            PRIVATE COMPUTER SYSTEM

*Nov 22 10:46:07 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT :                    YOU SHOULD HAVE NO EXPECTATION OF PRIVACY.

*Nov 22 10:46:07 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT :           Any use of the system may be logged or monitored without

*Nov 22 10:46:07 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT :           further notice, and the resulting logs may be used as

*Nov 22 10:46:07 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT :           evidence in court. By continuing, you consent to your

*Nov 22 10:46:07 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT :           keystrokes and data content being monitored.

*Nov 22 10:46:07 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT :                              UNAUTHORIZED ACCESS

*Nov 22 10:46:07 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT :           Any unauthorized use of the system is unlawful, and may be

*Nov 22 10:46:07 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT :           subject to civil and/or criminal penalties.  Unauthorized

*Nov 22 10:46:07 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT :           access will be vigorously prosecuted.

*Nov 22 10:46:07 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT :

*Nov 22 10:46:07 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT : 2901_Ship_4>

*Nov 22 10:46:07 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : IN  : 2901_Ship_4>enable

*Nov 22 10:46:07 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT : 2901_Ship_4#

*Nov 22 10:46:07 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : IN  : 2901_Ship_4#ssh -l ubnt 192.168.2.11

*Nov 22 10:46:08 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT : Password:

*Nov 22 10:46:08 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : IN  : fly2the*

*Nov 22 10:46:08 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT :

*Nov 22 10:46:08 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT :

*Nov 22 10:46:08 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 22 10:46:08 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT : Enter 'help' for a list of built-in commands.

*Nov 22 10:46:08 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT :

*Nov 22 10:46:08 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT : XM.v5.5.6#

*Nov 22 10:46:08 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : IN  : mca-status

*Nov 22 10:46:08 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT : mca-status

*Nov 22 10:46:08 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 22 10:46:08 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT :

*Nov 22 10:46:08 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT : apMac=DC:9F:DB:6A:A2:17

*Nov 22 10:46:08 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT : wlanOpmode=ap

*Nov 22 10:46:08 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT : wlanConnections=3

*Nov 22 10:46:08 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT : wlanUptime=1212726

*Nov 22 10:46:08 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT : essid=2400

*Nov 22 10:46:08 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT : freq=2429

*Nov 22 10:46:08 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT : signal=-40

*Nov 22 10:46:08 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT : noise=-89

*Nov 22 10:46:08 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT : ccq=989

*Nov 22 10:46:08 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT : uptime=1212726

*Nov 22 10:46:08 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT : loadavg=0

*Nov 22 10:46:08 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT : memTotal=62012

*Nov 22 10:46:08 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT : memFree=43176

*Nov 22 10:46:08 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT : memBuffers=2340

*Nov 22 10:46:08 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT : ackTimeout=24

*Nov 22 10:46:08 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT : distance=450

*Nov 22 10:46:08 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT : lanIpAddress=0.0.0.0

*Nov 22 10:46:08 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : CTL : 20+ lines read from cli, debug output truncated

*Nov 22 10:46:08 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : IN  : event manager environment 900MhzTX 0

*Nov 22 10:46:09 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT : event manager environment 900MhzTX 0

*Nov 22 10:46:09 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT : -sh: event: not found

*Nov 22 10:46:09 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT : XM.v5.5.6#

*Nov 22 10:46:09 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : IN  : config t

*Nov 22 10:46:10 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT : config t

*Nov 22 10:46:10 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT : -sh: config: not found

*Nov 22 10:46:10 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT : XM.v5.5.6#

*Nov 22 10:46:10 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : IN  : exit

*Nov 22 10:46:11 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT : exit

*Nov 22 10:46:11 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT :

*Nov 22 10:46:11 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT : [Connection to 192.168.2.11 closed by foreign host]

*Nov 22 10:46:11 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : OUT : 2901_Ship_4#

*Nov 22 10:46:11 UTC: %HA_EM-6-LOG: Radio_Reader : DEBUG(cli_lib) : : CTL : cli_close called.

*Nov 22 10:46:11 UTC:

*Nov 22 10:46:11 UTC: tty is now going through its death sequence

2901_Ship_4#

2901_Ship_4#

1 REPLY
Cisco Employee

Applet - Load command results into a variable -- and then post a

The truncation is just for debug.  The output itself is not truncated as it is stored in the variable.  See the other threads on how to extract what you want.

778
Views
0
Helpful
1
Replies