Configuring and Displaying System Statistics on a Switch


You can display system statistics on a switch using the system-stats-show command. This command displays the memory and CPU usage statistics. The parameters under system-stats-show command are:


switch - The current switch of which the statistics are being displayed.

uptime - The amount of time for which the switch has been online.

used-mem - Percentage of memory used by the switch.

used-mem-val - The amount of memory used by the switch.

used-swap - The percentage of swap memory used by the switch.

used-swap-val - The amount of swap memory used by the switch.

paging - The swap scan rate.

cpu-user - The percentage of CPU usage associated with user processes.

cpu-sys - The percentage of CPU usage associated with system processes.

cpu-total - The total usage of the CPU in percentage.

cpu-idle - The percentage of CPU idle time.

cpu-avg - The average CPU usage (cpu-sys + cpu-user) over last 30 seconds.


For example:

CLI (network-admin@switch1) > system-stats-show layout vertical

 

switch:      switch1

uptime:      7h7m10s

used-mem:    54%

used-swap:   0%

paging:      0

cpu-user:    2%

cpu-sys:     5%

cpu-idle:    92%

cpu-avg:     3%


To view all the details, add the parameter format all:


CLI (network-admin@switch1) > system-stats-show layout vertical format all


switch:        switch1

uptime:        7h5m41s

used-mem:      54%

used-mem-val:  3.84G

used-swap:     0%

used-swap-val: 0

paging:        0

cpu-user:      4%

cpu-sys:       4%

cpu-total:     9%

cpu-idle:      90%

cpu-avg:       3%



To view the system statistics within last 5 minutes, use the command:


CLI (network-admin@switch1) > system-stats-show within-last 5m layout vertical

switch:      switch1

time:        08:06:26

uptime:      3426684193d8h52m32s

used-mem:    63%

used-swap:   0%

paging:      0

cpu-user:    0%

cpu-sys:     99%

cpu-idle:    0%

switch:      switch1

time:        08:07:26

uptime:      3427378633d4h10m24s

used-mem:    63%

used-swap:   0%

paging:      0

cpu-user:    2%

cpu-sys:     2%

cpu-idle:    95%

switch:      switch1

time:        08:08:26

uptime:      3428073072d10h3m41s

used-mem:    63%

used-swap:   0%

paging:      0

cpu-user:    2%

cpu-sys:     1%

cpu-idle:    95%

switch:      switch1

time:        08:09:26

uptime:      3428767511d20h1m42s

used-mem:    63%

used-swap:   0%

paging:      0

cpu-user:    2%

cpu-sys:     2%

cpu-idle:    95%


The paging field of the system-stats-show command displays the swap scan rate. A non-zero value in this field shows that memory is being paged from the physical memory (RAM) to virtual memory (disk or swap). A consistently high value in this field indicates that all memory, both physical and virtual, is exhausted and the system may stop responding.



Configuring and Displaying System Statistics History


In releases prior to NetVisor OS version 6.10, the system-stats-show command provided instantaneous values of CPU usage, which was not representative of the average CPU usage over a duration. NetVisor OS release 6.1.0 improves the infrastructure for collecting and displaying system statistics to provide average usage information. NetVisor OS currently supports viewing of historical CPU and memory usage over the last 24 hours with a granularity of up to 10s.


You can enable system statistics history by using the command:


CLI (network-admin@switch1) > system-stats-history-settings-modify enable


system-stats-history-settings-modify

Modify system statistics history settings.

enable|disable

Enable or disable system statistics history. The default status is enable.


When you enable the collection of historical system usage data, a new thread is created in nvOSd to collect statistics periodically. You can turn off this thread by using the disable option the CLI. If you disable statistics history collection and re-enable the feature, the statistics collection starts from scratch. Also, if you restart nvOSd or reboot the switch while system statistics history is enabled, statistics history is cleared and statistics collection starts afresh.


To view the settings for collection of system statistics history, use the command:


CLI (network-admin@switch1) > system-stats-history-settings-show

switch:        switch1

enable:        yes

read-interval: 10s


Note that the read interval is set to 10s in the software and is not configurable.


To display system statistics history over the last one minute (with a granularity of 10s), last 1 hour (with a granularity of 1 minute), and last 24 hours (with a granularity of 1 hour), use the command:


CLI (network-admin@switch1*) > system-stats-history-show

### Usage over last 1 minute, 60 minutes and last 24 hours ###


time           mem-used(%) cpu-used(%) cpu-peak(%) over-last 

-------------- ----------- ----------- ----------- --------- 

01:48:24       54          4                       10s       

01:48:14       54          3                       10s       

01:48:04       54          3                       10s       

01:47:54       54          3                       10s       

01:47:44       54          3                       10s       

01:47:34       54          3                       10s       

01:47:34       54          3           3           1m        

01:46:34       53          3           5           1m        

01:45:34       53          3           4           1m        

01:44:34       53          2           3           1m        

01:43:34       53          3           4           1m        

01:42:34       53          3           3           1m        

01:41:34       53          3           4           1m        

01:40:34       53          3           4           1m        

01:39:34       53          2           3           1m        

.

.

.       

00:56:34       53          2           3           1m        

00:55:34       53          3           4           1m        

00:54:34       53          3           4           1m        

00:53:34       53          3           4           1m        

00:52:34       53          3           3           1m        

00:51:34       53          3           4           1m        

00:50:34       53          3           4           1m        

00:49:34       53          3           4           1m        

00:48:34       53          3           4           1m        

01:33:34       53          2           3           1h        

00:33:34       53          2           3           1h        

02-24,23:33:34 53          2           3           1h        

02-24,22:33:34 53          2           3           1h        

02-24,21:33:34 53          2           3           1h   


Note: The system statistics history values are populated with time. For example, if you want to view the statistics history for the last 24 hours, nvOSd must have run for the last 24 hours with system statistics history enabled.


If you disable system statistics history, running the commands system-stats-history-show and sytem-stats-history-average-show returns an error. For example:


CLI (network-admin@switch1) > system-stats-history-settings-modify disable


CLI (network-admin@switch1) > system-stats-history-show

system-stats-history-show: system stats history collection is disabled


CLI (network-admin@switch1) > system-stats-history-average-show over-last 10s

system-stats-history-average-show: system stats history collection is disabled



To view the average system usage statistics over the last 10 to 60 seconds, use the command:


CLI (network-admin@switch) > system-stats-history-average-show

system-stats-history-average-show

Display average system statistics over a given duration.

over-last duration:#s

Specify a duration for average usage statistics (in multiples of 10s from 10s up to 60s).


Note: You cannot specify the duration in days, hours, or minutes.


For example, view the average memory and CPU usage for the last 40s by using the command:


CLI (network-admin@switch1*) > system-stats-average-show over-last 40s

time     mem-used(%) cpu-used(%) over-last 

-------- ----------- ----------- --------- 

02:00:34 54          3           40s   


For system statistics older than one day, use the system-stats-show within-last <#d#h#m#s> command.

north
    keyboard_arrow_up
    keyboard_arrow_down
    description
    print
    feedback
    support
    business
    rss_feed
    south