linux system operation and maintenance of common query

Linu commonly used commands to view system, cpu, memory, network card traffic

See cpu summary information (Ubuntu, Linux, CentOS):
#lscpu
Architecture: # the x86_64 architecture the x86_64
the CPU (S): 2 Number of teeth # logical cpu is 2
the Thread (S) per Core:. 1 # is the number of threads per core. 1                 
Core (s) per socket: 2 # cpu each core slot number / number of every single physical cpu core is 2
the cPU socket (S): the number of slots is #cpu. 1. 1
vendor ID: GenuineIntel #cpu vendor ID is GenuineIntel
the cPU Family : 6 #cpu series is 6
model: # 58 model 58
stepping: stepping is 9 # 9 \ k
the CPU MHz: 800.000 #cpu clocked at 800MHz
Virtualization: VT-x virtualization technology #cpu-support of the X-VT
Hypervisor Vendor: # The current platform VMware
Virtualization type: full # virtualization type
L1d cache: 32K # cache 32K (cpu representation of L1 data cache is 32k )
of L1i cache: # 32K 32K cache (L1 instruction cache is specifically 32K)
L2 of cache: 3072K # 3072K secondary cache
See cpu operating mode

getconf LONG_BIT

32
(described in 32bit current CPU operation mode, but does not mean that CPU does not support 64bit)

getconf LONG_BIT

64
(described in 64bit current CPU operation mode, but does not mean that CPU does not support 32bit)

View the current operating system kernel information
# uname -a
Linux OpenStack 2.6.32-431.el6.x86_64 # 1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 the GNU / Linux
view the current operating system release information
 #cat / etc / Issue
the CentOS Release 6.5 (Final)
Kernel \ R & lt ON AN \ m
monitoring system status
1.W
linux system operation and maintenance of common query
time, system running time, number of users logged, average load: there are three values
1: 1 minute mean value of the system load;
2 : 5 minutes average load value system;
the average load value 3:15 min system; CPU unit time the number of active processes, of course, the greater the value it means that your server the greater the pressure, the normal state is less than the total number of server CPU.

2.Vmstat
linux system operation and maintenance of common query
. 1) displaying process-related information procs
r: represents the run and wait cpu time slice number of processes, if the server is larger than the number of cpu long, then the cpu not enough;
B: represents the number of processes waiting for a resource, such as Wait I / O, memory, etc., this column if the value is greater than 1 for a long time, then you need to look up;
2) memory memory-related information
swpd: a handoff to the amount of memory swap partition;
as free: the current number of free memory;
buff: a buffer size, (to be written to disk);
cache: cache size, (reading from disk);
. 3) where the swap swapping
si: number memory by entering the exchange zone;
SO: enter the memory from the swap number;
. 4) IO disk usage
bi: block device for reading data (disk read) from;
BO: block device from writing data (writing disk);
. 5) System in the number of occurrences of interruption collection interval
in: represents observed at a certain time interval the device interrupts per second;
CS: represents the number of context switches per second produced;
. 6) displays the cPU usage state of the cpu
us: Shows the percentage of cpu time spent in user;
SY: percentage of cpu time spent display system;
ID: indicates the percentage of time in idle cpu;
WA: represents I / O wait time occupied percentage of cpu;
ST: represents stolen the cpu percentage (usually 0, no concern);
Often concerned about r columns, b column, and wa columns. Bi IO part, bo if the disk io pressure is large, the value of these two columns will be higher. In addition, when the value si, so two relatively high, and when changing the description is not enough memory, the frequent exchange of data in memory to the swap, which is often a great impact on system performance.
linux system operation and maintenance of common query
'vmstat 1 5' represents every time the printing system of a second state, continuous printing 5 times.
3.Top
linux system operation and maintenance of common query
This command is used to dynamically monitor the progress of the share system resources, change once every 3 seconds. This feature command is to take up system resources (CPU, memory, disk IO, etc.) into the top of the highest of the process. Information system load (load average) top command to print, the number (Tasks) process, cpu usage, memory usage, and swap usage.
Use the top command when -bn1 this combination of options, which represents the non-dynamic printing system resource usage, can be used in a script
linux system operation and maintenance of common query
-b: Batch the MODE Operation
Starts top in 'Batch the MODE', Which could BE Useful for sending the Output from top to OTHER to A or Programs
. File the In the this MODE, Top Will Not Accept The INPUT and the runs an until you've Iterations limit with SET The '-n'
Command-Line Option or an until killed.
-n: AS Number The limit of Iterations: -n number
At The Number The maximum of the Iterations Specifies, or Frames, Top Produce Should the before Ending.
• Batch mode operation
from the "batch mode" start, which may be useful for sending output from top to other programs or a
file. In this mode, top will not accept input and runs until the iterations limit you've set up a '-'
command line option or until death.
• The number of iterations is limited to: - the number of
iterations specified maximum, or frame, should result in the end.
4.Sar
linux system operation and maintenance of common query
1) View card information flow
1. Review the historical traffic information card -n DEV command sar
linux system operation and maintenance of common query
IFACE: means that the device name
rxpck / s indicates the number of (unit Byte) into the second charge packets
txpck / s express sent per second the number of packets
rxbyt / s the amount of data received per second (unit Byte)
txbyt / S represents the amount of data transmitted per
-A: the sum of all reported
-u: statistical information output from the CPU usage
-v: output inode , file and other kernel statistics table
-d: each block activity information output device
-r: statistics information output memory and swap space
-b: the I / O transfer rate statistics and
-a: file read and write case
-c: output process statistics, the process of creating per second
-R: statistical information output memory pages
-y: terminal equipment activities
-w: output system activity information
-o: -o log.txt output to the current directory, the results in the form of output file
if one day you managed server packet loss is very serious, then you should take a look at this NIC traffic is abnormal, if rxpck / s the row of values greater than 4000, or rxbyt / s greater than the column that it is likely to be 5,000,000 *** or the copy data.
2. View the current LAN traffic information 'sar -n DEV 1 5'
3. View Card No. 20 traffic information 'sar -n DEV -f / var / log / SA / SA20 | More'
2) View history load 'sar - Q '
linux system operation and maintenance of common query
[the root local master @] -H SAR #
usage: sar [option] [<interval> [<number>]]
primary and reporting options:
-b the I / O status and transmission rate information
-B status tab
-d block device status
-I {<interrupt> | SUM | ALL | xALL}
interrupt condition
-m power management status information
-n {<keyword> [, ...] | ALL}
network statistics
keywords may be:
the DEV NIC
EDEV card (error)
NFS NFS client
NFSD NFS server
SOCK sockets (sockets) (V4)
IP IP flow (V4)
EIP stream IP (v4) (error)
ICMP ICMP flow (V4)
EICMP flow ICMP (v4) (error)
TCP TCP flow (V4)
ETCP TCP stream (v4) (error)
UDP UDP stream (V4)
SOCK6 Sockets (Sockets) (V6)
IP6 IP flow ( V6)
EIP6 the IP flow (V6) (error)
ICMP6 the ICMP flow (V6)
EICMP6 the ICMP flow (V6) (error)
to UDP6 in the UDP stream (V6)
-q queue length and average load
-r memory utilization
-R memory status
-S swap space utilization
-u [ALL]
the CPU utilization
-v Kernel table status
-w system task is created and conversion statistics
-W exchange information
-y TTY device condition
5.Free
total memory size of the system and the current memory usage and the remaining memory situation, -m -g displayed in the display GB to MB.
linux system operation and maintenance of common query
6.Ps
PS the AUX | grep sshd plus pipe, and use grep
linux system operation and maintenance of common query
PID: id processes, this id is useful to identify and manage one drive in linux kernel process management must rely on pid, for example, I want to terminate a particular process , use 'kill process pid', sometimes not kill, you will need to add the -9 option of a 'kill -9 process pid'
STAT: represents the state of the process, the process state is divided into the following
D can not interrupt the process (usually IO)
R Running in the process
S has been interrupted process, usually, most of the system processes all the state
T the process has stopped or suspended, if we are running a command, such as sleep 10, if we let him pause click ctrl -z, then we will use ps to view the status display T
W this seems to say, from the kernel 2.6 after xx, represented as there is not enough memory page allocation
X already dead process (this never seems to occur)
the Z-zombie process, not kill, beat to death garbage process, accounting system a little bit of resources, but does not matter. If too much, there will be problems. Generally does not appear.
<High-priority process
N low-priority process
L has been locked in memory paging
s main process
l multithreaded processes
+ represents a process running in the foreground
7.netstat view network status
netstat command to print a network connection status, system open ports, routing table information
linux system operation and maintenance of common query
netstat -lnp (which ports print the current network status, and system startup)
linux system operation and maintenance of common query
netstat -an (print network connection)
with grep and pipe symbol to monitor specific information on other services such as netstat -an | grep 80

Guess you like

Origin blog.51cto.com/7794482/2428223