Monthly Archives: June 2012

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