Automate Running Show Commands

This feature runs the integrated Python script watch.py to run a specified show command periodically and display the output accordingly. In the script, CLI paging is disabled so that user input is not needed, and CLI refreshing is disabled so that the keyword “no-refresh” is not needed in auto-refreshing commands.

To run a specified show command, use the following command:

watch command {difference} {count count} {interval interval}.

Example

The following example runs the show ports command for port 11 runs 15 times with an interval of 30 seconds:

# watch "show ports 11 statistics port-number no-refresh" count 15 interval 30
Port      Link       Tx Pkt     Tx Byte      Rx Pkt     Rx Byte      Rx Pkt      Rx Pkt      Tx Pkt      Tx Pkt 

          State       Count       Count       Count       Count       Bcast       Mcast       Bcast       Mcast 

========= ===== =========== =========== =========== =========== =========== =========== =========== =========== 

11        A          206845    30061110      205326    30939540           0      163381           0      163483 

========= ===== =========== =========== =========== =========== =========== =========== =========== =========== 

          > in Port indicates Port Display Name truncated past 8 characters 

          > in Count indicates value exceeds column width. Use 'wide' option or '0' to clear. 

          Link State: A-Active, R-Ready, NP-Port Not Present, L-Loopback 

 

Port      Link       Tx Pkt     Tx Byte      Rx Pkt     Rx Byte      Rx Pkt      Rx Pkt      Tx Pkt      Tx Pkt 

          State       Count       Count       Count       Count       Bcast       Mcast       Bcast       Mcast 

========= ===== =========== =========== =========== =========== =========== =========== =========== =========== 

11        A          206845    30061110      205327    30939662           0      163382           0      163483 

========= ===== =========== =========== =========== =========== =========== =========== =========== =========== 

          > in Port indicates Port Display Name truncated past 8 characters 

          > in Count indicates value exceeds column width. Use 'wide' option or '0' to clear. 

          Link State: A-Active, R-Ready, NP-Port Not Present, L-Loopback 

 

Port      Link       Tx Pkt     Tx Byte      Rx Pkt     Rx Byte      Rx Pkt      Rx Pkt      Tx Pkt      Tx Pkt 

          State       Count       Count       Count       Count       Bcast       Mcast       Bcast       Mcast 

========= ===== =========== =========== =========== =========== =========== =========== =========== =========== 

11        A          206847    30061402      205328    30939832           0      163383           0      163485 

========= ===== =========== =========== =========== =========== =========== =========== =========== =========== 

          > in Port indicates Port Display Name truncated past 8 characters 

          > in Count indicates value exceeds column width. Use 'wide' option or '0' to clear. 

          Link State: A-Active, R-Ready, NP-Port Not Present, L-Loopback