如何列出伺服器上所有的TCP_alloc?

如何列出伺服器上所有的TCP_alloc?

我在我的伺服器上運行node_exporter,node_exporter顯示伺服器上有超過5K的TCP_alloc。重啟伺服器後,TCP_alloc的計數仍然超過5K。當我運行命令時只有幾行netstat -anltup。這是列出 TCP_alloc 的正確方法嗎?如何列出所有的TCP_alloc並減少這個值?

答案1

#!/bin/bash
for i in  /proc/* ;
do
  if [ -d $i/fd ];then
    echo $i   $(ls $i/fd -l | grep socket: |wc -l)
  fi
done

找出每個進程的所有TCP連線。現在沒事了。

相關內容