centos8平台使用nethogs基于进程监控网络流量

摘要:
1、 netogs的作用:当我们通过进程或程序实时检查网络带宽的使用情况时,我们知道源IP地址和访问端口,这不足以帮助我们识别进程。Netogs允许我们查看每个进程占用的流量带宽。很明显,刘宏迪的建筑森林是一个专注于建筑的博客。地址是:https://www.cnblogs.com/architectforest相应的源代码可在此处访问:https://github.com/liuhong

一,nethogs的作用:

     按进程或程序实时统计网络带宽使用率

     我们查看流量的占用时,知道来源的ip、访问的端口,还不足以帮我们确认到进程,

     而nethogs则可以让我们查看每个进程所占用的流量带宽

说明:刘宏缔的架构森林是一个专注架构的博客,地址:https://www.cnblogs.com/architectforest

         对应的源码可以访问这里获取: https://github.com/liuhongdi/

 说明:作者:刘宏缔 邮箱: 371125307@qq.com

二,安装nethogs:

[root@yjweb ~]# yum install nethogs 

说明:如果yum报错没有任何匹配,则先安装epel源

[root@localhost liuhongdi]# yum install epel-release

三,查看nethogs的版本

[root@yjweb ~]# nethogs -V
 version 0.8.5

四,查看帮助

[root@yjweb ~]# nethogs -help
usage: nethogs [-V] [-h] [-b] [-d seconds] [-v mode] [-c count] [-t] [-p] [-s] [device [device [device ...]]]
                -V : prints version.
                -h : prints this help.
                -b : bughunt mode - implies tracemode.
                -d : delay for update refresh rate in seconds. default is 1.
                -v : view mode (0 = KB/s, 1 = total KB, 2 = total B, 3 = total MB). default is 0.
                -c : number of updates. default is 0 (unlimited).
                -t : tracemode.
                -p : sniff in promiscious mode (not recommended).
                -s : sort output by sent column.
                -a : monitor all devices, even loopback/stopped ones.
                device : device(s) to monitor. default is all interfaces up and running excluding loopback

When nethogs is running, press:
 q: quit
 s: sort by SENT traffic
 r: sort by RECEIVE traffic
 m: switch between total (KB, B, MB) and KB/s mode

五,nethogs 的常用命令

1,每隔5秒刷新一次输出结果

[root@yjweb ~]# nethogs -d 5

说明:默认间隔是1秒

2,按发送的数据量倒排

[root@yjweb ~]# nethogs -s

说明:默认是按RECEIVE的数据量倒排

3,监控所有的网卡

[root@yjweb ~]# nethogs -a

4,监控指定的一个或多个网卡

[root@yjweb ~]# nethogs eth0 eth1

5,监测指定的次数

[root@yjweb ~]# nethogs eth0 -c 3

说明:次数更新完即退出

六,nethogs的交互指令

m : Cycle between display modes (kb/s, kb, b, mb) 切换网速显示单位
r : Sort by received. 按接收流量排序
s : Sort by sent. 按发送流量排序
q : Quit and return to the shell prompt. 退出NetHogs命令工具

七,查看当前的centos版本

[root@yjweb ~]# cat /etc/redhat-release
CentOS Linux release 8.0.1905 (Core)

免责声明:文章转载自《centos8平台使用nethogs基于进程监控网络流量》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇C#之文件的读写(一)mock测试及jacoco覆盖率下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

CentOS查看CPU、内存、网络流量和磁盘 I/O【详细】

安装 yum install -y sysstat sar -d 1 1 rrqm/s: 每秒进行 merge 的读操作数目。即 delta(rmerge)/swrqm/s: 每秒进行 merge 的写操作数目。即 delta(wmerge)/sr/s: 每秒完成的读 I/O 设备次数。即 delta(rio)/sw/s: 每秒完成的写 I/O 设备次数。...

windows网络流量监控

NPCap 官网 https://nmap.org/npcap/ 这是抓包必须先安装的工具,具体的原因可以看 https://github.com/buger/goreplay/wiki/Running-on-Windows due to the nature of different networking layer of Windows stack....

CentOS7 监控网络流量

首先,以下介绍的流量监控工具安装之前均需要安装epel源, 安装epel源: [root@bogon ~]# yum -y install epel-release 安装 iftop 工具,查看各个连接的流量情况 [root@bogon ~]# yum -y install iftop [root@bogon ~]# iftop -i ens33 -n -...

观察网络流量的工具-iptraf-ng

最近看到vmlinux大神介绍了一款网络查看工具,感觉很好用,下面进行简要摘录: iptraf-ng 可以方便查看当前服务器网络状况:CentOS 7.0,采用了衍生版本iptraf-ng 。 iptraf-ng -h usage: iptraf-ng [options] or: iptraf-ng [options] -B [-i <ifac...

windows获取系统网络流量

函数   DWORD GetIfTable(          PMIB_IFTABLE pIfTable,          PULONG pdwSize,          BOOL bOrder   ); 功能   获取MIB-II接口列表 参数   PMIB_IFTABLE pIfTable:接收缓冲区,接收GetIfTable返回的MIB-I...

OpenStack Neutron 之 Load Balance

OpenStack Neutron 之 Load Balance 负载均衡(Load Balance)是 OpenStack Neutron 支持的功能之一。负载均衡能够将网络请求分发到多个实际处理请求的虚机上,这样能有效处理高流量的网络请求,负载均衡在现实中有很多使用场景。本文将基于 Neutron 所提供的负载均衡,介绍其基本概念、实现过程,并验证...