cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1205
Views
0
Helpful
2
Replies

How to write output to file in flash

Jonn cos
Level 4
Level 4

hi all experts.

I want to monitor a specific link. Lets say when it goes down, i want to write the following to a file in flash called link_mon.txt

link down <show clock output>

When it gets back up

link up <show clock output>

I know how to write the applets and use sla tracking for monitoring, i just want to know how to write the output(user defined) to a file in flash ?

2 Replies 2

Jonn cos
Level 4
Level 4

Not a single reply ?

I know no one is obliged to answer but this is very de-motivational for me :-(

Where should i ask questions now :-(

Joe Clarke
Cisco Employee
Cisco Employee

What you want to do is not possible using applets.  You can write CLI output to flash using the redirect command:

action 1.0 cli command "enable"

action 2.0 cli command "show clock | redirect flash:/output.txt"

But you cannot include your own custom text.  For that, you will need to use an EEM Tcl policy.  Within the Tcl policy, the code to write the output to flash would look like:

if { [catch {cli_open} result] } {

   error $result $errorInfo

}

array set cli $result

set fd [open "flash:/output.txt" "a"]

set output [cli_exec $cli(fd) "show clock"]

puts $fd "link down $output"

close $fd

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: