Hello
Today I’m at work and i’m doing paranoid upgrade checks before equally paranoid (amount-wise) upgrades.
Let’s say that before the upgrade you want to check how many CDP neighbors you have. Your naming plan for your infrastructure is simple:
- names of switches begin with SWT
- names of APs begin with AP
- names of phones begin with SEP
- etc
Of course we run the command show cdp neighbor to display the number of neighbors. We want to do two things before an upgrade:
- count the number of neighbors
- export the output of the command to some backup server
You can count the number of neighbors with:
show cdp neighbor | count ^(SWT|AP|SEP)
Number of lines which match regexp = 44
You can export the output of any command with the redirect option:
show cdp neighbor | redirect ftp://1.1.1.1/mybackups/backupofshowcdpneiSwitch1beforeNov5upgrade.txt
and then after the upgrade:
show cdp neighbor | redirect ftp://1.1.1.1/mybackups/backupofshowcdpneiSwitch1afterNov5upgrade.txt