cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
112
Views
0
Helpful
4
Replies
Beginner

Dump switch commands to a file on a schedule?

Hello,

 

Cisco are asking me to run some commands on a Nexus switch 3 times a day and for a few days.  There are about 10 show and run bash commands I need to run manually.

 

Is there a tool I can schedule all this and dump to a file?

 

Thanks

4 REPLIES 4
Highlighted
VIP Mentor

Re: Dump switch commands to a file on a schedule?

Hi
Cisco Nexus supports EEM you could run the standard commands and dump them to bootflash , or send them to yourself by email either , not sure you may have tweak script get it for bash though

This is just an example would run every 6 hours dump results toi flash depending on comamds in text file , you may need to tweak it

event manager applet Collect_Results
event timer watchdog time 21600
action 1.0 cli command "enable"
action 2.0 cli command "show logging | append bootflash:Results"
action 2.5 cli command"show run | append bootflash:Results"
action 3.0 syslog priority notifications msg " Running_Config_Backup_Complete"

check this too for email and working examples , you could build your own script for it

https://www.ciscozine.com/send-email-from-your-router-using-eem/

 

 

Cisco prime could do it too if you have that ., you can build custom reports and output collections from devices using its reporting tools

Beginner

Re: Dump switch commands to a file on a schedule?

Thanks,

 

This is what they want me to run and dump to file 3 times a day for 3 days:

 

show clock
show system resources
show system internal memory-status
show system internal kernel meminfo
show system internal memory-alerts-log
show system internal flash
run bash sudo cat /proc/slabinfo

b)
show virtual-service list
show virtual-service detail
run bash sudo pstree -Aap 1
run bash sudo lsof
run bash sudo cat /proc/mounts
run bash sudo cat /cgroup/1/services/vdc_1_guestshell+/memory.limit_in_bytes
run bash sudo cat /cgroup/1/services/vdc_1_guestshell+/memory.usage_in_bytes
guestshell run sudo df -h

c)
run bash sudo ls -trlh /bootflash/
run bash sudo ls -trlh /mnt/pss
run bash sudo ls -trlh /bootflash/virt_strg_pool_bf_vdc_1/_rootfs.guestshell+

 

Do you think this is possible?

VIP Mentor

Re: Dump switch commands to a file on a schedule?

i have not ran all those bash commands before so you may need to test each one first as some have to be ran from # mode and some conft mode so the script would need to jump in and out of both modes to complete.

You will probably spend as long building the script as running the commands for EEM if not familiar with it , you could also just use putty and set it to capture log file and run the show commands and bash commands in one go dump to a text file that way

you will need to turn on feature bash-shell too for those bash commands to work
Beginner

Re: Dump switch commands to a file on a schedule?

Putty & dump to file is what I'm doing, I think I will just stick with that, but thanks anyway.
CreatePlease to create content
Content for Community-Ad
July's Community Spotlight Awards