cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2773
Views
0
Helpful
3
Replies

Need script to export some of a show command to a text file

nickydd9
Level 1
Level 1

Hello,

 

What I am trying to accomplish is setting up a script that will repeatedly run sh interface interfacename every 30 seconds or so, and to take the "30 second output rate" from within that output and export it to a text file. Each time the "30 second output rate" is exported to the text file it should be time stamped within the text file.

 

Can the text file stay stored on the router until I am ready to stop the script and then export it elsewhere (maybe via TFTP)?

 

Forgive my ignorance on this matter.

1 Accepted Solution

Accepted Solutions

balaji.bandi
Hall of Fame
Hall of Fame

writing in your device may overload once the flash is full you may see another issues, instead you can move to FTP or TFTP  

 

example and options you can see to send output.

 

event manager applet intstats
  event timer watchdog name timer time 30
action 1.0 cli command "enable"
action 2.0 cli command "show interface gi 0/0 | append ftp://user:pass@10.10.10.10/intoutput.txt"

image.png

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

View solution in original post

3 Replies 3

balaji.bandi
Hall of Fame
Hall of Fame

writing in your device may overload once the flash is full you may see another issues, instead you can move to FTP or TFTP  

 

example and options you can see to send output.

 

event manager applet intstats
  event timer watchdog name timer time 30
action 1.0 cli command "enable"
action 2.0 cli command "show interface gi 0/0 | append ftp://user:pass@10.10.10.10/intoutput.txt"

image.png

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

Hi @balaji.bandi! This is pretty helpful so far. I still have a few more tweaks that probably need to be made. Here is what I setup:

 

event manager applet intstats
  event timer watchdog name timer time 30
action 1.0 cli command "enable"
action 1.1 cli command "show interface fastethernet4 | redirect tftp://192.168.26.220/intoutput.txt"
action 1.2 cli command "show clock | redirect tftp://192.168.26.220/intoutput.txt"

 The reason I am using "show clock" was because that was the only way I could figure to actually timestamp the output each time. My issue though is that each time the script runs I only end up with the latest output of the show clock. I believe this is because I am using "redirect" probably and not "append"? When I tried to use append I got an error that "Append is not supported by the file system" do you know what that means?

Not sure about the error, as long as the file is RW (read-write access to anyone) it will append the file end of each line.

 

good idea to use clock EEM have built time if you like to use...but make it simple show clock is good.

 

 

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help