Centos利用nethogs工具分析带宽使用率高问题
如果是正常业务访问以及正常应用进程导致的带宽使用率高,需要升级服务器的带宽进行解决。如果是非正常访问,如某些特定IP的恶意访问,或者服务器遭受到了CC攻击。或者异常进程导致的带宽使用率高。可以通过流量监控工具nethogs来实时监测统计各进程的带宽使用情况,并进行问题进程的定位。
1.安装nethogs工具
yum install nethogs -y
2.使用nethogs
style="margin-bottom: 0.1in; line-height: 150%; page-break-inside: auto; orphans: 2; widows: 2; background: #ffffff; page-break-before: auto; page-break-after: auto;">nethogs命令常用参数说明如下:
style="margin-left: -0.25in; text-indent: 0.29in; margin-bottom: 0in; border: none; padding: 0in; line-height: 150%; page-break-inside: auto; orphans: 2; widows: 2; page-break-before: auto; page-break-after: auto;">-d:设置刷新的时间间隔,默认为 1s。
style="margin-left: -0.25in; text-indent: 0.29in; margin-top: 0.08in; margin-bottom: 0in; border: none; padding: 0in; line-height: 150%; page-break-inside: auto; orphans: 2; widows: 2; page-break-before: auto; page-break-after: auto;">-t:开启跟踪模式。
style="margin-left: -0.25in; text-indent: 0.29in; margin-top: 0.08in; margin-bottom: 0in; border: none; padding: 0in; line-height: 150%; page-break-inside: auto; orphans: 2; widows: 2; page-break-before: auto; page-break-after: auto;">-c:设置更新次数。
style="margin-left: -0.25in; text-indent: 0.29in; margin-top: 0.08in; margin-bottom: 0in; border: none; padding: 0in; line-height: 150%; page-break-inside: auto; orphans: 2; widows: 2; page-break-before: auto; page-break-after: auto;">device:设置要监测的网卡,默认是eth0。
style="margin-bottom: 0.1in; line-height: 150%; page-break-inside: auto; orphans: 2; widows: 2; background: #ffffff; page-break-before: auto; page-break-after: auto;">运行时可以输入以下参数完成相应的操作:
style="margin-left: -0.25in; text-indent: 0.29in; margin-bottom: 0in; border: none; padding: 0in; line-height: 150%; page-break-inside: auto; orphans: 2; widows: 2; page-break-before: auto; page-break-after: auto;">q:退出nethogs工具。
style="margin-left: -0.25in; text-indent: 0.29in; margin-top: 0.08in; margin-bottom: 0in; border: none; padding: 0in; line-height: 150%; page-break-inside: auto; orphans: 2; widows: 2; page-break-before: auto; page-break-after: auto;">s:按发送流量大小的顺序排列进程列表。
style="margin-left: -0.25in; text-indent: 0.29in; margin-top: 0.08in; margin-bottom: 0in; border: none; padding: 0in; line-height: 150%; page-break-inside: auto; orphans: 2; widows: 2; page-break-before: auto; page-break-after: auto;">r:按接收流量大小的顺序排列进程列表。
style="margin-left: -0.25in; text-indent: 0.29in; margin-top: 0.08in; margin-bottom: 0in; border: none; padding: 0in; line-height: 150%; page-break-inside: auto; orphans: 2; widows: 2; page-break-before: auto; page-break-after: auto;">m:切换显示计量单位,切换顺序依次为KB/s、KB、B、MB。
style="margin-left: -0.25in; text-indent: 0.29in; margin-top: 0.08in; margin-bottom: 0in; border: none; padding: 0in; line-height: 150%; page-break-inside: auto; orphans: 2; widows: 2; page-break-before: auto; page-break-after: auto;">执行以下命令,查看指定的网络端口每个进程的网络带宽使用情况:
nethogs eth0
版权保护: 本文「Centos利用nethogs工具分析带宽使用率高问题」由 云主机配置专家 原创,转载请保留链接: https://www.miandns.com/docs/system/590.html