How to check quality of the Cisco IOS and CatOS configuration backup

 

One of the easiest ways to check Cisco configuration file quality is using shell script.
Our script will parse output to see if the following keywords are in the configuration file: "version", "show running-config", "begin", and "end".
If not all of the keywords found, then it will print the name of the file.

#!/bin/bash
for TEMPFILE in *
do
 TEMPCOUNT=0
 egrep "^(version|#version)" $TEMPFILE > /dev/null
 RETVAL=$?
 [ $RETVAL -eq 0 ] && TEMPCOUNT=`expr $TEMPCOUNT + 1`
 egrep "^(show running-config|begin)" $TEMPFILE > /dev/null
 RETVAL=$?
 [ $RETVAL -eq 0 ] && TEMPCOUNT=`expr $TEMPCOUNT + 1`
 egrep "^(end)" $TEMPFILE > /dev/null
 RETVAL=$?
 [ $RETVAL -eq 0 ] && TEMPCOUNT=`expr $TEMPCOUNT + 1`
 if [ $TEMPCOUNT -ne 3 ]; then
  echo $TEMPFILE
 fi
done

In another example, we just look for "version" keyword.

#!/bin/bash
for TEMPFILE in *
do
 egrep "^(version|#version)" $TEMPFILE > /dev/null
 RETVAL=$?
 [ $RETVAL -eq 0 ] && echo Found sting in $TEMPFILE
 [ $RETVAL -ne 0 ] && echo No string found in $TEMPFILE
done

Moving your apps to Amazon or Miscrosoft Clouds?

We can help you analyze your existing infrastructure, identify the cost savings we can achieve by migrating to a cloud provider. We can then execute end-to-end migration plan of your infrastructure and bringing down your TCO.

Cloud Computing

Ready for IPv6 Migration?

The Internet is running out of the equivalent of phone numbers - familiar problem, non-trivial solution.

The world has to move to IPv6, with its 128-bit addresses. But that's easier said than done.

IPv6 Migration

Are you fluent in "Linux"?

Learn Linux from a leading expert and quickly master you Linux skills.

Learn how to simplify your workflow and increase your productivity using tips and techniques of the pros.

Ideal training for Corporate IT Beginners and Advanced IT Admins alike.

Corporate Linux Training

Who's Online

We have 7 guests and no members online