Tcl Ping Script on Nexus

Just like IOS, Nexus supports Tcl. In IOS I’ve used a simple Tcl script for checking connectivity to mulitple hosts. In Nexus, Tcl has changed slightly (like many other things). Below is the IOS tcl ping script, and here you can find an expanded guide for Tcl on IOS 12.4, and Tcl on IOS 15.2.

Router# tclsh
 Router(tcl) foreach address {
 +>(tcl)#10.0.0.1
 +>(tcl)#10.0.0.2
 +>(tcl)#10.0.0.3
 +>(tcl)#} { ping $address
 +>#}

Nexus introduces some new layers of functionality, and for this Tcl script, you must use ‘cli’ before the ping command. You can find more info here about Tcl on NX-OS.

Router# tclsh
 Router(tcl) foreach address {
 +>(tcl)#10.0.0.1
 +>(tcl)#10.0.0.2
 +>(tcl)#10.0.0.3
 +>(tcl)#} { cli ping $address
 +>#}

This little script can be as simple or complex as you like. For different connectivity checks, you could replace ‘ping’ with ‘traceroute’, ‘arp’, or other useful, similar cli commands.

Advertisements

One thought on “Tcl Ping Script on Nexus

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s