Linux服务器维护 统计连接数查看外部IP 新风宇宙

Linux服务器维护 统计连接数查看外部IP 服务器上的一些统计数据:

1)统计80端口连接数

Shell代码  收藏代码
  1. netstat -nat|grep -i "80"|wc -l  
netstat -nat|grep -i "80"|wc -l

 2)统计httpd协议连接数

Shell代码  收藏代码
  1. ps -ef|grep httpd|wc -l  
     ps -ef|grep httpd|wc -l         , pstree -aup|grep httpd|wc -l

 3)、统计已连接上的,状态为“established'

Shell代码  收藏代码
  1. netstat -na|grep ESTABLISHED|wc -l  
netstat -na|grep ESTABLISHED|wc -l

 4)、查出哪个IP地址连接最多,将其封了.

Shell代码  收藏代码
  1. netstat -na|grep ESTABLISHED|awk '{print $5}'|awk -F: '{print $1}'|sort|uniq -c|sort -r   
netstat -na|grep ESTABLISHED|awk '{print $5}'|awk -F: '{print $1}'|sort|uniq -c|sort -r 
Shell代码  收藏代码
  1. netstat -na|grep SYN|awk '{print $5}'|awk -F: '{print $1}'|sort|uniq -c|sort -r  
原文地址:https://www.cnblogs.com/php5/p/2100378.html