Watch コマンド
NX-OS 7.0(3)I2(x) より watch コマンドが実装され、簡単にカウンタの追跡等が実行できるようになりました。
watch コマンド内で指定されたコマンドは指定されたインターバルごとに実行され、表示差分のみをハイライトします。
コマンド形式は以下の通りです。
# watch differences interval <second> [コマンドを指定]
実行例は以下の通りで、実際には更新のある値のみハイライトされ、1秒おきに更新されます。
Every 1.0s: vsh -c "show int e1/3 counters detailed " Wed Jan 25 07:46:14 2017
Ethernet1/3
Rx Packets: 152748822
Rx Unicast Packets: 152748817
Rx Broadcast Packets: 5
Rx Bytes: 152748816384
Rx Packets from 0 to 64 bytes: 6
Rx Packets from 512 to 1023 bytes: 152748816
Tx Packets: 152973541
Tx Unicast Packets: 152973383
Tx Multicast Packets: 138
Tx Broadcast Packets: 23
Tx Bytes: 152973417204
Tx Packets from 0 to 64 bytes: 3
Tx Packets from 65 to 127 bytes: 22
Tx Packets from 128 to 255 bytes: 138
Tx Packets from 512 to 1023 bytes: 152973382
Diff オプション
従来の NX-OS より実装されている方法ですが、diff オプションによりコマンドの表示結果の変化を追跡することができます。
# [コマンド] | diff
以下のようなコマンドを2回実行してもどのカウンタにどの程度推移があるかを直感的に判別するのは難しいです。
switch# show int e1/3 counters detailed
Ethernet1/3
Rx Packets: 116195988
Rx Unicast Packets: 116195984
Rx Broadcast Packets: 5
Rx Bytes: 116195983384
Rx Packets from 0 to 64 bytes: 6
Rx Packets from 512 to 1023 bytes: 116195983
Tx Packets: 116420702
Tx Unicast Packets: 116420549
Tx Multicast Packets: 133
Tx Broadcast Packets: 23
Tx Bytes: 116420581974
Tx Packets from 0 to 64 bytes: 3
Tx Packets from 65 to 127 bytes: 22
Tx Packets from 128 to 255 bytes: 133
Tx Packets from 512 to 1023 bytes: 116420548
switch# show int e1/3 counters detailed
Ethernet1/3
Rx Packets: 116380178
Rx Unicast Packets: 116380173
Rx Broadcast Packets: 5
Rx Bytes: 116380172384
Rx Packets from 0 to 64 bytes: 6
Rx Packets from 512 to 1023 bytes: 116380172
Tx Packets: 116604892
Tx Unicast Packets: 116604739
Tx Multicast Packets: 133
Tx Broadcast Packets: 23
Tx Bytes: 116604771974
Tx Packets from 0 to 64 bytes: 3
Tx Packets from 65 to 127 bytes: 22
Tx Packets from 128 to 255 bytes: 133
Tx Packets from 512 to 1023 bytes: 116604738
diff オプションを使うと、1回目と2回目の表示結果の差分だけを表示しますので比較が簡単です。
switch# show int e1/3 counters detailed | diff
switch# show int e1/3 counters detailed | diff
2,3c2,3
< Rx Packets: 121111274
< Rx Unicast Packets: 121111269
---
> Rx Packets: 121577062
> Rx Unicast Packets: 121577057
5c5
< Rx Bytes: 121111268384
---
> Rx Bytes: 121577056384
7,9c7,9
< Rx Packets from 512 to 1023 bytes: 121111268
< Tx Packets: 121335987
< Tx Unicast Packets: 121335834
---
> Rx Packets from 512 to 1023 bytes: 121577056
> Tx Packets: 121801776
> Tx Unicast Packets: 121801623
12c12
< Tx Bytes: 121335866974
---
> Tx Bytes: 121801655974
16c16
< Tx Packets from 512 to 1023 bytes: 121335833
---
> Tx Packets from 512 to 1023 bytes: 121801622
以下のようなコマンドを実行すれば1分間のカウンタの推移を取得することができます。
(";" でつなげることで1行で実行できます。)
switch# show int e1/3 counters detailed | i "Unicast Packets" | diff ; sleep 60 ; show int e1/3 counters detailed | i "Unicast Packets" | diff
1,2c1,2
< Rx Unicast Packets: 94161510
< Tx Unicast Packets: 94386076
---
> Rx Unicast Packets: 95397684
> Tx Unicast Packets: 95622250
関連ドキュメント