Too many connections in Linux
1、在连接数报警的机器上,查看某个端口tcp连接来源,并排序
netstat -natl |grep ^tcp |grep ":443" |awk '{print $5}' |awk -F":" '{count[$1]++}; END{for(ip in count) print ip, ": " count[ip]}' |sort -n -k3 -r
2、找到最多的tcp对应的机器,在那台机器上查看哪个进程占用最多连接
netstat -nap |grep ":443" |awk '{print $7}' |awk -F"/" '{print $1}' | sort | uniq -c | sort -nr
Disclaimer
- License under
CC BY-NC 4.0
- Copyright issue feedback
me#imzye.me
, replace # with @ - Not all the commands and scripts are tested in production environment, use at your own risk
- No privacy information is collected here