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

How can I schedule $sh ver to run every Sunday and extract (preferably just the version number) and dump it in a CSV file?

manuplusplus
Level 1
Level 1

Hi there

Every week I have to login to several servers and run #sh ver command which gives a long output. I just need the version number.

How can I schedule $sh ver to run every Sunday and extract (preferably just the version number) and dump it in a CSV file?

Help will be appreciated.

Thanks so much.

2 Replies 2

Philip D'Ath
VIP Alumni
VIP Alumni

RANCID is very good at doing this kind of thing, and a lot more - and is free.

http://www.shrubbery.net/rancid/

It doesn't dump it to a CSV file, but monitors for changes and will tell you if it does change.

Francesco Molino
VIP Alumni
VIP Alumni

I assume you want to do that directly on routers or switches? If you want to do that through servers then rancid is a good tool.

On the routers or switches you can do commands with 2 pipes |.

For that you need to do sh ver | i Version and redirect output to a file.

I will suggest to solve that issue by using tcl scripts.

Here an example:

puts [open "flash:shver.tcl" w+] {
set file [open "flash:version.csv" "w+"]
set vers [exec "sh ver | i Version"]
set date [exec "sh clock"]
puts $file $date
puts $file $vers
close $file
}

kron occurrence VER at 0:16 sun recurring
policy-list VER
kron policy-list VER
cli enable
cli tclsh flash:shver.tcl
cli exit

You can even add a line in the policy to export that file on a ftp or tufts by using :

cli copy flash:/version.csv tftp://x.x.x.x/version.csv

Hope this answering your question


Thanks
Francesco
PS: Please don't forget to rate and select as validated answer if this answered your question
Review Cisco Networking for a $25 gift card