sonic-utilities icon indicating copy to clipboard operation
sonic-utilities copied to clipboard

Add fabric capacity monitoring cmds

Open jfeng-arista opened this issue 1 year ago • 1 comments

What I did

Added fabric capacity monitoring related commands and the tests.

To config the warning threshold

~# config fabric
Usage: config fabric [OPTIONS] COMMAND [ARGS]...

  FABRIC-related configuration tasks

Options:
  -h, -?, --help  Show this message and exit.

Commands:
  monitor  FABRIC MONITOR configuration tasks
  port     FABRIC PORT configuration tasks
~# config fabric monitor
Usage: config fabric monitor [OPTIONS] COMMAND [ARGS]...

  FABRIC MONITOR configuration tasks

Options:
  -h, -?, --help  Show this message and exit.

Commands:
  capacity  FABRIC MONITOR CAPACITY configuration tasks
~# config fabric monitor capacity 
Usage: config fabric monitor capacity [OPTIONS] COMMAND [ARGS]...

  FABRIC MONITOR CAPACITY configuration tasks

Options:
  -?, -h, --help  Show this message and exit.

Commands:
  threshold  FABRIC CAPACITY MONITOR THRESHOLD configuration tasks
~# config fabric monitor capacity threshold 90
~#

To show the capacity :

~# show fabric 
Usage: show fabric [OPTIONS] COMMAND [ARGS]...

  Show fabric information

Options:
  -h, -?, --help  Show this message and exit.

Commands:
  counters      Show fabric port counters
  isolation     Show fabric isolation status
  monitor       Show fabric monitor
  reachability  Show fabric reachability
~# show fabric  monitor 
Usage: show fabric monitor [OPTIONS] COMMAND [ARGS]...

  Show fabric monitor

Options:
  -?, -h, --help  Show this message and exit.

Commands:
  capacity  Show fabric capacity
~# show fabric  monitor capacity
Monitored fabric capacity threshold:  90%

  ASIC    Operating     Total #        %    Last Event    Last Time
              Links    of Links
------  -----------  ----------  -------  ------------  -----------
 asic0           32         144  22.2222         Lower  0:19:17 ago
 asic1           28         144  19.4444         Lower  0:19:17 ago
 asic2           32         144  22.2222         Lower  0:19:17 ago
 asic3           28         144  19.4444         Lower  0:19:17 ago
 asic4           32         144  22.2222         Lower  0:19:17 ago
 asic5           28         144  19.4444         Lower  0:19:17 ago
 asic6           32         144  22.2222         Lower  0:19:19 ago
 asic7           28         144  19.4444         Lower  0:19:16 ago
 asic8           32         144  22.2222         Lower  0:19:16 ago
 asic9           28         144  19.4444         Lower  0:19:20 ago
asic10           31         144  21.5278         Lower  0:19:16 ago
asic11           28         144  19.4444         Lower  0:19:17 ago
~#
~# config fabric monitor capacity threshold 10
~# show fabric  monitor capacity
Monitored fabric capacity threshold:  10%

  ASIC    Operating     Total #        %    Last Event    Last Time
              Links    of Links
------  -----------  ----------  -------  ------------  -----------
 asic0           32         144  22.2222        Higher  0:00:03 ago
 asic1           28         144  19.4444        Higher  0:00:03 ago
 asic2           32         144  22.2222        Higher  0:00:03 ago
 asic3           28         144  19.4444        Higher  0:00:03 ago
 asic4           32         144  22.2222        Higher  0:00:03 ago
 asic5           28         144  19.4444        Higher  0:00:03 ago
 asic6           32         144  22.2222        Higher  0:00:05 ago
 asic7           28         144  19.4444        Higher  0:00:02 ago
 asic8           32         144  22.2222        Higher  0:00:02 ago
 asic9           28         144  19.4444        Higher  0:00:06 ago
asic10           31         144  21.5278        Higher  0:00:02 ago
asic11           28         144  19.4444        Higher  0:00:03 ago

How I did it

How to verify it

Previous command output (if the output of a command-line utility has changed)

New command output (if the output of a command-line utility has changed)

jfeng-arista avatar Apr 02 '24 17:04 jfeng-arista

@vmittal-msft @arlakshm

jfeng-arista avatar Apr 02 '24 17:04 jfeng-arista

revised code based on review comments

jfeng-arista avatar Apr 23 '24 22:04 jfeng-arista