Take the 2-minute tour ×
Network Engineering Stack Exchange is a question and answer site for network engineers. It's 100% free, no registration required.

Is there any way to show a total count of interfaces that are in status "up" on a cisco router?

The purpose is to let a script go through all routers and show a summarization count of "up" interfaces.

share|improve this question
    
ex: cisco 881, v12.4 –  Bulki Feb 17 at 14:59

2 Answers 2

up vote 3 down vote accepted

You can show all interfaces that are up by:

show interfaces status | include connected

Then your script can count them.

The show interfaces status cli command shows you all interfaces. The interfaces that are "up" are in the connected state. The | include connected shows only the lines of the output that contain the word "connected".

Newer Cisco IOS contain a count parameter that can count lines which match a regex. This is not available on all IOS versions.

share|improve this answer
    
The problem is here that I have a script that already does the batch executing on multiple routers so I need the count in one line as a response. Is this possible? –  Bulki Feb 17 at 13:23
    
After reading the Cisco documentation, there is a | count option in newer IOS (15.x) but it's only in the newer IOS versions so you can't be sure if it's available. –  Sebastian Feb 17 at 13:37
    
idd, the count option did the trick :) –  Bulki Feb 17 at 14:57

You may also use these commands:

sh ip int bri | include up
sh int des | include up

share|improve this answer
2  
This is a bit prone to false positives, since any port with 'up' in the description will always match regardless of its state. –  Teun Vink Feb 18 at 6:40
    
Yeah, but it does show line protocol status, which is beneficial in troubleshooting layer 1 and 2 interface issues. –  chris Feb 18 at 6:50
    
To get rid of false positives use: show ip int br | i up.*up –  Nutsy Feb 19 at 23:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.