Q: CAN you repeatedly SSH from within a TCL script to, for example, a radio . . .

Unanswered Question
Nov 5th, 2013
User Badges:

. .. to get the current Line Rate to then write that speed to the Bandwidth statement for an Interface to make routine protocols more accurate over radio links with varying modulations?


My Googling says tells me that you can log in but any commands you issue will hang.  Can you SSH and retrieve command results from remote hosts in Cisco TCL?



Thanks!


Tim

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
Loading.
Joe Clarke Wed, 11/06/2013 - 11:30
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

Yep.  You can do this given new enough IOS.  The link on that slide goes to an EEM solution that does this.

tproeber Thu, 11/07/2013 - 08:04
User Badges:

Is it possible to get a stand-alone exapmle of SSH?  The "No Easy Shell" is NOT easy like it says . . .


I've been trying to get a script written or find DETAILED help for a while now.  Ican't even find a contractor to write this.  I have about 1 week left before I switch to RouterBoard.  They have scripting and help available.  Those guys Latvia guys are great!


Thanks,


Tim

Joe Clarke Sat, 11/09/2013 - 14:42
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

At its core the script spawns the SSH command, then uses cli_read_pattern and cli_write to interact with the remote connection.  For example (without error checking):


cli_write $cli(fd) "ssh -l user host.example.com"

cli_read_pattern $cli(fd) "assword:"

cli_write $cli(fd) "mypassword"

cli_read_pattern $cli(fd) "#"

cli_write $cli(fd) "sho ver"

set output [cli_read_pattern $cli(fd) "#"]

puts $output


That help?

tproeber Mon, 11/11/2013 - 13:48
User Badges:

I guess it needs an cli_open too?


I am realllllllllllllly trying to write a functioning script.


TCL on Cisco gets NO RESPECT at www.oceaneering.com because no one knows about it and they only have ME telling them and I can't get a GD thing to run.

Joe Clarke Mon, 11/11/2013 - 15:26
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

Yes, cli_open is needed as is a cli_close:


array set cli [cli_open]

...

catch {cli_close $cli(fd) $cli(tty_id)}


Note, there are a lot of examples in this community that work and can help get you started with EEM and EEM Tcl.  An easy way to get started with EEM Tcl is to take an applet that does what you want or parts of what you want and put it into http://www.marcuscom.com/convert_applet/ to get the Tcl version.

tproeber Tue, 11/12/2013 - 10:14
User Badges:

I'm going one step at a time and want to do a demo of each command I will use. 


Here I am trying to read a sho-run environmental variable called TestVar and then write what I read to a different sho-run enviromental variable called EnvRead.


But it's not working . .



$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$



#event manager environment TestVar 1

#event manager environment MyVar 129

#event manager environment EnvRead              <----- This is not getting set with TestVar

#event manager directory user policy "flash:/"

#event manager policy test-tcl.tcl

# copy tftp://192.168.104.5/test-tcl.tcl flash:

# ##############################################

::cisco::eem::event_register_timer watchdog time 10

namespace import ::cisco::eem::*

namespace import ::cisco::lib::*


# Open a virtual telnet

if { [catch {cli_open} result] } {

error $result $errorInfo

}

array set cli $result


# Enter Enable Mode

if { [catch {cli_exec $cli(fd) "enable"} result] } {

error $result $errorInfo

}


# Check if the Variable MyVar already exists and if not create and set to 0;

if { ! [info exists MyVar] } {

set MyVar 0

} else {

if { [catch {context_retrieve MyContext MyVar} result] } {

set MyVar 0

} else {

set MyVar $result

}

}


# Increment the retrieved MyVar

incr MyVar


# Now re-save the variable MyVar

catch {context_save MyContext MyVar}


#!!# READ and Save an Environmental Variable

if [catch {cli_exec $cli(fd) "sho event manager environment TestVar"} result] {

error $result $errorInfo

}


else {

set EnVarRead $result

}


####  Enter Config t   ###

if { [catch {cli_exec $cli(fd) "config t"} result] } {

error $result $errorInfo

}


# Write an Envronmental Varible that shows up in the Sho-run

if { [catch {cli_exec $cli(fd) "event manager environment MyVar $MyVar"} result] } {

error $result $errorInfo

}



# Write the test EnVarRead  . .

if { [catch {cli_exec $cli(fd) "event manager environment EnvRead $EnVarRead"} result] } {

error $result $errorInfo

}



# Close the Telnet

catch {cli_close $cli(fd) $cli(tty_id)}


### END ###;

Joe Clarke Tue, 11/12/2013 - 10:35
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

Trying to set an environment variable to the value of CLI output is not a good idea.  The CLI output will not be exactly what you think it is.  If you do:


set l [split $result "\n"]

foreach line [lrange $l 0 end-1] {

    set line [string trim $line]

    if { $line != "" } {

        set EnvVarRead $line

    }

}

tproeber Tue, 11/12/2013 - 14:52
User Badges:

I got the Navy script -- it was for load-balancng over 12 TWELVE serial lines!


I surrender!  I'm getting a contractor



namespace import ::cisco::eem::*
namespace import ::cisco::lib::*

array set _mar_einfo [event_reqinfo_multi]

set _i 1
foreach _tag [list syslog] {
    if { [info exists _mar_einfo($_tag)] } {
        set _event_tag$_i $_tag
        array set arr_einfo_$_i $_mar_einfo($_tag)
        incr _i
    }
}


if [catch {cli_open} result] {
    error $result $errorInfo
} else {
    array set cli1 $result
}

if [catch {cli_exec $cli1(fd) "enable"} _cli_result] {
    error $_cli_result $errorInfo
}

action_syslog msg "Scan thru HWIC-4T Slot 0 interfaces ..."
foreach int "Serial0/0/0 Serial0/0/1 Serial0/0/2 Serial0/0/3 Serial0/1/0 Serial0/1/1 Serial0/1/2 Serial0/1/3 Serial0/2/0 Serial0/2/1 Serial0/2/2 Serial0/2/3" {
    if [catch {cli_exec $cli1(fd) "show ip int $int | in $int"} _cli_result] {
        error $_cli_result $errorInfo
    }

    set _regexp_result [regexp {line protocol is down} "$_cli_result"]
    if {$_regexp_result == 1} {
        action_syslog msg "$int: line protocol is down; Skip to next ..."
        continue
    }
    if [catch {cli_exec $cli1(fd) "show controller $int | inc (Clock|clock rate)"} _cli_result] {
        error $_cli_result $errorInfo
    }

    set _regexp_result [regexp {clock rate ([0-9]+)} "$_cli_result" ignore clock]
    if {$_regexp_result != 1} {
        set _regexp_result [regexp {clk ([0-9]+)/} "$_cli_result" ignore clock]
    }
    if {$_regexp_result != 1} {
        action_syslog msg "Failed to find clock rate for $int"
        continue
    }
    set _result [expr $clock / 1000]
    set _remainder [expr $clock % 1000]
    set bandwidth "$_result"
    if {$_remainder >= 500} {
        incr bandwidth 
    }
    if {$bandwidth <= 115} {
        action_syslog msg "$int: Bandwidth too low for QoS Policy. Skip it!"
        continue
    } elseif {$bandwidth <= 400} {
        set newQosPolicy "INM"
    } elseif {$bandwidth <= 1200} {
        set newQosPolicy "SATCOM-LOW"
    } elseif {$bandwidth <= 3000} {
        set newQosPolicy "SATCOM-MED"
    } else {
        set newQosPolicy "SATCOM-HI"
    }
    action_syslog msg "$int: for $bandwidth Kbps use Policy $newQosPolicy"
    if [catch {cli_exec $cli1(fd) "config t"} _cli_result] {
        error $_cli_result $errorInfo
    }

    if [catch {cli_exec $cli1(fd) "interface $int"} _cli_result] {
        error $_cli_result $errorInfo
    }

    if [catch {cli_exec $cli1(fd) "bandwidth $bandwidth"} _cli_result] {
        error $_cli_result $errorInfo
    }

    if [catch {cli_exec $cli1(fd) "do show policy-map $newQosPolicy | inc Policy Map"} _cli_result] {
        error $_cli_result $errorInfo
    }

    set _regexp_result [regexp {Policy Map ([A-Za-z0-9\-]+\_*[A-Za-z0-9\-]+)} "$_cli_result" ignore qosPolicyMap]
    if {$_regexp_result != 1} {
        if [catch {cli_exec $cli1(fd) "end"} _cli_result] {
            error $_cli_result $errorInfo
        }

        action_syslog msg "int $int fail to find Policy-Map $newQosPolicy; no adjustment"
        continue
    }
    action_syslog msg "$int: Searching for Policy Map $qosPolicyMap ..."
    if {$newQosPolicy != $qosPolicyMap} {
        if [catch {cli_exec $cli1(fd) "end"} _cli_result] {
            error $_cli_result $errorInfo
        }

        action_syslog msg "fail to find configured qosPolicyMap $qosPolicyMap; no adjustment"
        continue
    }
    if [catch {cli_exec $cli1(fd) "do show run int $int | inc service-policy output"} _cli_result] {
        error $_cli_result $errorInfo
    }

    set _regexp_result [regexp {service-policy output ([A-Za-z0-9\-]+)} "$_cli_result" ignore oldQosPolicy]
    if {$_regexp_result == 1} {
        action_syslog msg "$int: Found: Policy Map $oldQosPolicy"
        if {$newQosPolicy == $oldQosPolicy} {
            if [catch {cli_exec $cli1(fd) "end"} _cli_result] {
                error $_cli_result $errorInfo
            }

            action_syslog msg "$int: QoS Policy $oldQosPolicy already in effect; no change."
        } else {
            if [catch {cli_exec $cli1(fd) "no service-policy output $oldQosPolicy"} _cli_result] {
                error $_cli_result $errorInfo
            }

            action_syslog msg "$int: Remove old QoS policy $oldQosPolicy"
            if [catch {cli_exec $cli1(fd) "service-policy output $newQosPolicy"} _cli_result] {
                error $_cli_result $errorInfo
            }

            action_syslog msg "$int: Applied new QoS policy $newQosPolicy"
            if [catch {cli_exec $cli1(fd) "end"} _cli_result] {
                error $_cli_result $errorInfo
            }

        }
    } else {
        action_syslog msg "$int: No QoS Policy currently configured! Fix it!"
        if [catch {cli_exec $cli1(fd) "service-policy output $newQosPolicy"} _cli_result] {
            error $_cli_result $errorInfo
        }

        action_syslog msg "$int: Applied new QoS policy $newQosPolicy"
        if [catch {cli_exec $cli1(fd) "end"} _cli_result] {
            error $_cli_result $errorInfo
        }

    }
}
action_syslog msg "Scan thru NM-4T Slot 1 interfaces ..."
foreach int "Serial1/0 Serial1/1 Serial1/2 Serial1/3" {
    if [catch {cli_exec $cli1(fd) "show ip int $int | in $int"} _cli_result] {
        error $_cli_result $errorInfo
    }

    set _regexp_result [regexp {line protocol is down} "$_cli_result"]
    if {$_regexp_result == 1} {
        action_syslog msg "$int: line protocol is down; Skip to next ..."
        continue
    }
    if [catch {cli_exec $cli1(fd) "show controller $int | inc (Clock|clock rate)"} _cli_result] {
        error $_cli_result $errorInfo
    }

    set _regexp_result [regexp {clock rate ([0-9]+)} "$_cli_result" ignore clock]
    if {$_regexp_result != 1} {
        set _regexp_result [regexp {clk ([0-9]+)/} "$_cli_result" ignore clock]
    }
    if {$_regexp_result != 1} {
        action_syslog msg "Failed to find clock rate for $int"
        continue
    }
    set _result [expr $clock / 1000]
    set _remainder [expr $clock % 1000]
    set bandwidth "$_result"
    if {$_remainder >= 500} {
        incr bandwidth 
    }
    if {$bandwidth <= 115} {
        action_syslog msg "$int: Bandwidth too low for QoS Policy. Skip it!"
        continue
    } elseif {$bandwidth <= 400} {
        set newQosPolicy "EHF"
    } elseif {$bandwidth <= 1200} {
        set newQosPolicy "SATCOM-LOW"
    } elseif {$bandwidth <= 3000} {
        set newQosPolicy "SATCOM-MED"
    } else {
        set newQosPolicy "SATCOM-HI"
    }
    action_syslog msg "$int: for $bandwidth Kbps use Policy $newQosPolicy"
    if [catch {cli_exec $cli1(fd) "config t"} _cli_result] {
        error $_cli_result $errorInfo
    }

    if [catch {cli_exec $cli1(fd) "interface $int"} _cli_result] {
        error $_cli_result $errorInfo
    }

    if [catch {cli_exec $cli1(fd) "bandwidth $bandwidth"} _cli_result] {
        error $_cli_result $errorInfo
    }

    if [catch {cli_exec $cli1(fd) "do show policy-map $newQosPolicy | inc Policy Map"} _cli_result] {
        error $_cli_result $errorInfo
    }

    set _regexp_result [regexp {Policy Map ([A-Za-z0-9\-]+\_*[A-Za-z0-9\-]+)} "$_cli_result" ignore qosPolicyMap]
    if {$_regexp_result != 1} {
        if [catch {cli_exec $cli1(fd) "end"} _cli_result] {
            error $_cli_result $errorInfo
        }

        action_syslog msg "int $int fail to find Policy-Map $newQosPolicy; no adjustment"
        continue
    }
    action_syslog msg "$int: Searching for Policy Map $qosPolicyMap ..."
    if {$newQosPolicy != $qosPolicyMap} {
        if [catch {cli_exec $cli1(fd) "end"} _cli_result] {
            error $_cli_result $errorInfo
        }

        action_syslog msg "fail to find configured qosPolicyMap $qosPolicyMap; no adjustment"
        continue
    }
    if [catch {cli_exec $cli1(fd) "do show run int $int | inc service-policy output"} _cli_result] {
        error $_cli_result $errorInfo
    }

    set _regexp_result [regexp {service-policy output ([A-Za-z0-9\-]+)} "$_cli_result" ignore oldQosPolicy]
    if {$_regexp_result == 1} {
        action_syslog msg "$int: Found: Policy Map $oldQosPolicy"
        if {$newQosPolicy == $oldQosPolicy} {
            if [catch {cli_exec $cli1(fd) "end"} _cli_result] {
                error $_cli_result $errorInfo
            }

            action_syslog msg "$int: QoS Policy $oldQosPolicy already in effect; no change."
        } else {
            if [catch {cli_exec $cli1(fd) "no service-policy output $oldQosPolicy"} _cli_result] {
                error $_cli_result $errorInfo
            }

            action_syslog msg "$int: Remove old QoS policy $oldQosPolicy"
            if [catch {cli_exec $cli1(fd) "service-policy output $newQosPolicy"} _cli_result] {
                error $_cli_result $errorInfo
            }

            action_syslog msg "$int: Applied new QoS policy $newQosPolicy"
            if [catch {cli_exec $cli1(fd) "end"} _cli_result] {
                error $_cli_result $errorInfo
            }

        }
    } else {
        action_syslog msg "$int: No QoS Policy currently configured! Fix it!"
        if [catch {cli_exec $cli1(fd) "service-policy output $newQosPolicy"} _cli_result] {
            error $_cli_result $errorInfo
        }

        action_syslog msg "$int: Applied new QoS policy $newQosPolicy"
        if [catch {cli_exec $cli1(fd) "end"} _cli_result] {
            error $_cli_result $errorInfo
        }

    }
}
action_syslog msg "Scan thru NM-4T Slot 2 interfaces ..."
foreach int "Serial2/0 Serial2/1 Serial2/2 Serial2/3" {
    if [catch {cli_exec $cli1(fd) "show ip int $int | in $int"} _cli_result] {
        error $_cli_result $errorInfo
    }

    set _regexp_result [regexp {line protocol is down} "$_cli_result"]
    if {$_regexp_result == 1} {
        action_syslog msg "$int: line protocol is down; Skip to next ..."
        continue
    }
    if [catch {cli_exec $cli1(fd) "show controller $int | inc (Clock|clock rate)"} _cli_result] {
        error $_cli_result $errorInfo
    }

    set _regexp_result [regexp {clock rate ([0-9]+)} "$_cli_result" ignore clock]
    if {$_regexp_result != 1} {
        set _regexp_result [regexp {clk ([0-9]+)/} "$_cli_result" ignore clock]
    }
    if {$_regexp_result != 1} {
        action_syslog msg "Failed to find clock rate for $int"
        continue
    }
    set _result [expr $clock / 1000]
    set _remainder [expr $clock % 1000]
    set bandwidth "$_result"
    if {$_remainder >= 500} {
        incr bandwidth 
    }
    if {$bandwidth <= 115} {
        action_syslog msg "$int: Bandwidth too low for QoS Policy. Skip it!"
        continue
    } elseif {$bandwidth <= 400} {
        set newQosPolicy "INM"
    } elseif {$bandwidth <= 1200} {
        set newQosPolicy "SATCOM-LOW"
    } elseif {$bandwidth <= 3000} {
        set newQosPolicy "SATCOM-MED"
    } else {
        set newQosPolicy "SATCOM-HI"
    }
    action_syslog msg "$int: for $bandwidth Kbps use Policy $newQosPolicy"
    if [catch {cli_exec $cli1(fd) "config t"} _cli_result] {
        error $_cli_result $errorInfo
    }

    if [catch {cli_exec $cli1(fd) "interface $int"} _cli_result] {
        error $_cli_result $errorInfo
    }

    if [catch {cli_exec $cli1(fd) "bandwidth $bandwidth"} _cli_result] {
        error $_cli_result $errorInfo
    }

    if [catch {cli_exec $cli1(fd) "do show policy-map $newQosPolicy | inc Policy Map"} _cli_result] {
        error $_cli_result $errorInfo
    }

    set _regexp_result [regexp {Policy Map ([A-Za-z0-9\-]+\_*[A-Za-z0-9\-]+)} "$_cli_result" ignore qosPolicyMap]
    if {$_regexp_result != 1} {
        if [catch {cli_exec $cli1(fd) "end"} _cli_result] {
            error $_cli_result $errorInfo
        }

        action_syslog msg "int $int fail to find Policy-Map $newQosPolicy; no adjustment"
        continue
    }
    action_syslog msg "$int: Searching for Policy Map $qosPolicyMap ..."
    if {$newQosPolicy != $qosPolicyMap} {
        if [catch {cli_exec $cli1(fd) "end"} _cli_result] {
            error $_cli_result $errorInfo
        }

        action_syslog msg "fail to find configured qosPolicyMap $qosPolicyMap; no adjustment"
        continue
    }
    if [catch {cli_exec $cli1(fd) "do show run int $int | inc service-policy output"} _cli_result] {
        error $_cli_result $errorInfo
    }

    set _regexp_result [regexp {service-policy output ([A-Za-z0-9\-]+)} "$_cli_result" ignore oldQosPolicy]
    if {$_regexp_result == 1} {
        action_syslog msg "$int: Found: Policy Map $oldQosPolicy"
        if {$newQosPolicy == $oldQosPolicy} {
            if [catch {cli_exec $cli1(fd) "end"} _cli_result] {
                error $_cli_result $errorInfo
            }

            action_syslog msg "$int: QoS Policy $oldQosPolicy already in effect; no change."
        } else {
            if [catch {cli_exec $cli1(fd) "no service-policy output $oldQosPolicy"} _cli_result] {
                error $_cli_result $errorInfo
            }

            action_syslog msg "$int: Remove old QoS policy $oldQosPolicy"
            if [catch {cli_exec $cli1(fd) "service-policy output $newQosPolicy"} _cli_result] {
                error $_cli_result $errorInfo
            }

            action_syslog msg "$int: Applied new QoS policy $newQosPolicy"
            if [catch {cli_exec $cli1(fd) "end"} _cli_result] {
                error $_cli_result $errorInfo
            }

        }
    } else {
        action_syslog msg "$int: No QoS Policy currently configured! Fix it!"
        if [catch {cli_exec $cli1(fd) "service-policy output $newQosPolicy"} _cli_result] {
            error $_cli_result $errorInfo
        }

        action_syslog msg "$int: Applied new QoS policy $newQosPolicy"
        if [catch {cli_exec $cli1(fd) "end"} _cli_result] {
            error $_cli_result $errorInfo
        }

    }
}

# Close open cli before exit.
catch {cli_close $cli1(fd) $cli1(tty_id)} result
tproeber Thu, 11/21/2013 - 08:16
User Badges:

I can see the Line go up when it does the SSH, but the interface description is not changed.  Why?


event manager applet Int-Desc

event timer watchdog time 15

action 010 cli command "enable"

action 020 cli command "ssh -l cobra 192.168.101.1" pattern "assword:"

action 050 cli command "tiger$9" pattern "#"

action 060 cli command "conf t" pattern "#"

action 070 cli command "int g 0/1/7" pattern "#"

action 080 cli command "desc TEST" pattern "#"

action 090 cli command "exit" pattern "#"

action 100 cli command "exit" pattern "#"

Joe Clarke Thu, 11/21/2013 - 08:18
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

Enable "debug event manager action cli" and collect the output.

tproeber Thu, 11/21/2013 - 08:32
User Badges:

*Nov 21 10:23:59 UTC: %HA_EM-6-LOG: Int-Desc : DEBUG(cli_lib) : : OUT : 2901_Ship_4#

*Nov 21 10:23:59 UTC: %HA_EM-6-LOG: Int-Desc : DEBUG(cli_lib) : : IN  : 2901_Ship_4#ssh -l cobra 192.168.101.1

*Nov 21 10:24:00 UTC: %HA_EM-6-LOG: Int-Desc : DEBUG(cli_lib) : : OUT : Password:

*Nov 21 10:24:00 UTC: %HA_EM-3-FMPD_UNKNOWN_ENV: fh_parse_var: could not find environment variable: 9

*Nov 21 10:24:00 UTC: %HA_EM-3-FMPD_ERROR: Error executing applet Int-Desc statement 050

*Nov 21 10:24:00 UTC: %HA_EM-6-LOG: Int-Desc : DEBUG(cli_lib) : : CTL : cli_close called.

*Nov 21 10:24:00 UTC:

*Nov 21 10:24:00 UTC: tty is now going through its death sequence

2901_Ship_4#



Statement 50 is the password -- it's the correct password -- I can manually do the steps.



Thanks,


Tim

tproeber Thu, 11/21/2013 - 11:16
User Badges:

Found it -- I had to escape the $ sign in the password.


Progress!


Thanks,


Tim

tproeber Thu, 11/21/2013 - 14:11
User Badges:

I can SSH to the radio!


Now I need to extract the TX ands RX rates and range -- is this how I would do it?


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 050 cli command "fly2the*" pattern "#"

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


action 070 regexp "wlanTxRate=[0-9]{1,3}" "$_cli_result"

action 080 set 900Mhz-TX "$_regexp_result"


action 090 regexp "wlanRxRate=[0-9]{1,3}" "$_cli_result"

action 100 set 900Mhz-RX "$_regexp_result"


action 110 regexp "distance=[0-9]{1,3}" "$_cli_result"

action 120 set 900Mhz-Distance "$_regexp_result"



***** This is the output of the "mca-status" command:


XM.v5.5.6# mca-status

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

apMac=DC:9F:DB:6A:A2:17

wlanOpmode=ap

wlanConnections=3

wlanUptime=1142923

essid=2400

freq=2429

signal=-41

noise=-89

ccq=991

uptime=1142923

loadavg=0

memTotal=62012

memFree=43204

memBuffers=2340

ackTimeout=24

distance=0

lanIpAddress=0.0.0.0

wlanIpAddress=0.0.0.0

wlanTxRate=260.0

wlanRxRate=174.0

wlanTxLatency=1

wlanPolling=1

wlanPollingQuality=79

wlanPollingCapacity=62

lanRxBytes=414272179

lanRxPackets=477266935

lanRxErrors=0

lanTxBytes=1544971571

lanTxPackets=53035448

lanTxErrors=0

lanPlugged=1

lanSpeed=100Mbps-Full

wlanRxBytes=2040744381

wlanRxPackets=59880613

wlanRxErrors=1

wlanTxBytes=4012972456

wlanTxPackets=479018827

wlanTxErrors=0

wlanRxErrNwid=1147816

wlanRxErrCrypt=0

wlanRxErrFrag=0

wlanRxErrRetries=0

wlanRxErrBmiss=0

wlanRxErrOther=0

latitude=0.000000

longitude=0.000000

cfgCrc=1dee1a80

XM.v5.5.6#

Joe Clarke Sat, 11/23/2013 - 11:42
User Badges:
  • Cisco Employee,
  • Hall of Fame,

    Founding Member

Don't over-think it.  Use as simple expression as you can:


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

puts "TxRate is $txrate"


==> TxRate is 260.0

Actions

This Discussion