linux performance monitoring

Monitoring cpu usage uptime

Purpose: print current time, system running time, current login user and cpu load

[root@localhost ~]# uptime
 20:24:06 up  9:56,  3 users,  load average: 0.00, 0.01, 0.05
                                             1 Minutes 5 minutes 10 minutes load

Monitor the usage of memory and switch partition -- free

Purpose: display system memory and exchange partition

Usage: free -b|k|m specifies that the unit is bt kb mb respectively

[root@localhost ~]# free
              total        used        free      shared  buff/cache   available
Mem:        2865548      639888      532680       10640     1692980     1863776
Swap:       2097148         192     2096956

Monitor disk usage - df command

Purpose: to generate the usage capacity of the system disk space

Usage: df - Options

Option: - h humanized display

- i shows inode usage

- T show file system type

[root@localhost ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3        18G  4.0G   14G  23% /
devtmpfs        1.4G     0  1.4G   0% /dev
tmpfs           1.4G   84K  1.4G   1% /dev/shm
tmpfs           1.4G  8.7M  1.4G   1% /run
tmpfs           1.4G     0  1.4G   0% /sys/fs/cgroup
/dev/sda1       297M  123M  175M  42% /boot
tmpfs           280M   36K  280M   1% /run/user/0
/dev/sr0        3.8G  3.8G     0 100% /mnt

Monitoring network usage -- ip and netstat

ip

ip a view network card information

ip -s link show network card name query network card traffic information

[root@localhost ~]# ip a

[root@localhost ~]# ip -s link show eno16777736 
2: eno16777736: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
    link/ether 00:0c:29:da:3b:3f brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast   
    24869057   39473    0       0       0       0       
    TX: bytes  packets  errors  dropped carrier collsns 
    5896351    23490    0       0       0       0       

netstat

Purpose: print network connection, routing table, network interface statistics, etc

Usage: netstat option

Option: - s displays various protocol data statistics

- n use digital ip, port number, user id instead of host, protocol, user and other name information

- p displays the process name and the corresponding process id

- l display only the socket interface information being monitored

- u view udp connection

- t view tcp connection

[root@localhost ~]# netstat -nutlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:6000            0.0.0.0:*               LISTEN      71238/X             
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1536/sshd           
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      3141/master         
tcp6       0      0 :::6000                 :::*                    LISTEN      71238/X             
tcp6       0      0 :::22                   :::*                    LISTEN      1536/sshd           

 

Keywords: network socket

Added by ceci on Wed, 01 Jan 2020 23:18:54 +0200