【FreeBSD】资源使用查看

Posted by 西维蜀黍 on 2021-03-04, Last Modified on 2024-05-07

View Network Traffic

# Network Throughput
$ systat -ifs
                    /0   /1   /2   /3   /4   /5   /6   /7   /8   /9   /10
     Load Average   ||

      Interface           Traffic               Peak                Total
            lo0  in      0.391 KB/s          0.391 KB/s          341.838 KB
                 out     0.391 KB/s          0.391 KB/s          341.838 KB

            aq0  in    117.038 MB/s        117.038 MB/s           10.210 GB
                 out     2.935 MB/s          2.935 MB/s          261.974 MB

View Network Usage

# View network connection
$ systat -netstat
                    /0   /1   /2   /3   /4   /5   /6   /7   /8   /9   /10
     Load Average   ||

Local Address          Foreign Address        Proto Recv-Q Send-Q (state)
localhost.1031         *.*                    udp4       0      0
192.168.18.69.ntp      *.*                    udp4       0      0
localhost.ntp          *.*                    udp6       0      0
fe80:2::1.ntp          *.*                    udp6       0      0
localhost.ntp          *.*                    udp4       0      0
239.255.255.250.3702   *.*                    udp4       0      0
192.168.18.69.5357     *.*                    tcp4       0      0 LISTEN
192.168.18.69.http     192.168.18.60.54509    tcp4       0      0 ESTABLISHED
localhost.23485        localhost.x11          tcp4       0      0 ESTABLISHED
localhost.x11          localhost.23485        tcp4       0      0 ESTABLISHED
192.168.18.69.ssh      192.168.18.60.56126    tcp4       0    184 ESTABLISHED
192.168.18.69.5201     192.168.18.60.56131    tcp4       0      0 ESTABLISHED
192.168.18.69.5201     192.168.18.60.56132    tcp4       0      0 ESTABLISHED

# View TCP
$ systat -tcp
                    /0   /1   /2   /3   /4   /5   /6   /7   /8   /9   /10
     Load Average   ||

             TCP Connections                       TCP Packets
           0 connections initiated           44623 total packets sent
           0 connections accepted                3 - data
           0 connections established             0 - data (retransmit by dupack)
           0 connections dropped                 0 - data (retransmit by sack)
           0 - in embryonic state            44620 - ack-only
           0 - on retransmit timeout             0 - window probes
           0 - by keepalive                      0 - window updates
           0 - from listen queue                 0 - urgent data only
                                                 0 - control
                                                 0 - resends by PMTU discovery
             TCP Timers                      89243 total packets received
           3 potential rtt updates           89240 - in sequence
           3 - successful                        0 - completely duplicate
           1 delayed acks sent                   0 - with some duplicate data
           0 retransmit timeouts                 0 - out-of-order
           0 persist timeouts                    0 - duplicate acks
           0 keepalive probes                    3 - acks
           0 - timeouts                          0 - window probes
                                                 0 - window updates
                                                 0 - bad checksum

View Disk Usage

$ df -h
Filesystem                                                 Size    Used   Avail Capacity  Mounted on
boot-pool/ROOT/default                                     100G    1.2G     99G     1%    /

View Disk Statistics

$ systat -iostat
                    /0   /1   /2   /3   /4   /5   /6   /7   /8   /9   /10
     Load Average   ||

          /0%  /10  /20  /30  /40  /50  /60  /70  /80  /90  /100
cpu  user|
     nice|
   system|XX
interrupt|
     idle|XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

          /0%  /10  /20  /30  /40  /50  /60  /70  /80  /90  /100
nvd0  MB/sXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
      tps|XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX789.36
ada0  MB/s
      tps|
ada1  MB/s
      tps|
ada2  MB/s
      tps|
ada3  MB/s
      tps|
pass0 MB/s
      tps|
pass1 MB/s
      tps|
pass2 MB/s
      tps|
pass3 MB/s
      tps|
pass4 MB/s
# 每秒更新一次(-K 1),输出 100000 次(-c 100000),只显示 disk 信息(-d)
$ iostat -c 100000 -d -K 1

View Memory Usage

$ pkg install freecolor
$ freecolor -t -m -o -s 1
             total       used       free     shared    buffers     cached
Mem:         23764      21219       2545          0          0          0
Swap:         4096          0       4096
Total:       27860 = (   21219 (used) +     6641 (free))
$ freecolor -m -s 1
Physical  : [###................................] 10%	(2546/23764)
Swap      : [###################################] 100%	(4096/4096)

Reference