Of all connections:
Netstat-na|wc-l
Number of valid connections:
Netstat-nat|grep established|wc-l
The middle parameter established represents the number of valid connections!
Groups the number of connections in various states of the server and queries to get results:
Netstat-n | awk '/^tcp/{++s[$NF]} END {for (a in S) print A, s[a]} '
1) Count 80 port connections
Netstat-nat|grep-i "|wc-l"
2) Count httpd protocol connections
Ps-ef|grep httpd|wc-l
3), the statistics are connected, the status is "established
Netstat-na|grep established|wc-l
4), find out which IP address is the most connected, sealed it.
Netstat-na|grep Established|awk {print $5}|awk-f: {print $1}|sort|uniq-c|sort-r +0n
Netstat-na|grep Syn|awk {print $5}|awk-f: {print $1}|sort|uniq-c|sort-r +0n
---------------------------------------------------------------------------------------------
1. View the current number of concurrent accesses to Apache:
Netstat-an | grep established | Wc-l
Compare the number of maxclients in httpd.conf.
2. How many processes are viewed:
PS Aux|grep httpd|wc-l
3, you can use the following parameters to view the data
Server-status?auto
#ps-ef|grep Httpd|wc-l
1388
Count the number of httpd processes, and a single request initiates a process that is used for the Apache server.
Indicates that Apache can handle 1388 concurrent requests, which Apache can automatically adjust according to the load situation.
#netstat-nat|grep-i "|wc-l"
4341
Netstat-an will print the current network link state of the system, while Grep-i "80" is used to extract connections related to port 80, wc-l the number of connections counted.
The final number returned is the total number of requests for all 80 ports currently.
#netstat-na|grep Established|wc-l
376
Netstat-an Prints the current network link state of the system, and grep established extracts information about the established connection. Then wc-l statistics.
The final number returned is the total number of established connections for all current 80 ports.
netstat-nat| | grep ESTABLISHED|WC-To see detailed records of all established connections
View the number of httpd processes (that is, the number of concurrent requests that Apache can handle in prefork mode):
Linux commands:
Ps-ef | grep httpd | Wc-l
To view the number of concurrent requests for Apache and its TCP connection status:
Linux commands:
Netstat-n | awk '/^tcp/{++s[$NF]} END {for (a in S) print A, s[a]} '
Examples of returned results:
Last_ack 5
SYN_RECV 30
Established 1597
Fin_wait1 51
Fin_wait2 504
Time_wait 1057
Description
SYN_RECV indicates the number of requests waiting to be processed;
Established indicates the normal data transmission status;
Time_wait indicates the number of requests that have finished processing and waiting for the timeout to expire.
--------------------------------------
View the number of connections and the current number of connections
Netstat-ant | grep $IP: 80 | Wc-l
Netstat-ant | grep $IP: 80 | grep EST | Wc-l
View IP access times
Netstat-nat|grep ": |awk ' {print $} ' |awk-f: ' {print '} ' | Sort| Uniq-c|sort-n
Linux commands:
Netstat-n | awk '/^tcp/{++s[$NF]} END {for (a in S) print A, s[a]} '
Watch "Netstat-n | awk '/^tcp/{++s[\ $NF]} END {for (a in S) print A, S[a]} ' "
$ netstat-n | awk '/^tcp/{++s[$NF]} END {for (key in S) print key, "\ T", S[key]} '
Linux View server connections