centos8平台使用nethogs基于进程监控网络流量
2024-08-29 01:38:22
一,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)
最新文章
- 一、基于hadoop的nginx访问日志分析---解析日志篇
- assets 加载资源文件
- debian8 Apache 更改根目录
- Nancy 引用源码与NuGet安装差异
- js模拟类
- AI
- 受限玻尔兹曼机RBM—简易详解
- MVC小系列(一)【制作表格】
- Python学习 - 简单抓取页面
- SQL Server 中的嵌套事务与@@TranCount(转)
- MFC用GDI+动感歌词的制作
- java解析XML文件四种方法之引入源文件
- Javascrip动态添加样式,Dom操作,获取自定义属性
- python入门 -- 环境搭建(windows)
- 配置https and http2 local本地开发环境
- OWIN 自托管静态网站
- Apktool(3)——Apktool的使用
- Atitit 创业好处 Atitit 为什么我们要创业
- mysql和mariadb支持insert delayed的问题
- Golang匿名函数
热门文章
- 图解 Await 和 Async
- 《Java从入门到失业》第四章:类和对象(4.2):String类
- 《C++深度解析》课程目录
- [LeetCode]67. 二进制求和(字符串)(数学)
- 再学ajax--第二天 | 基于php+mysql+ajax的表单注册、登录、注销
- python-数据清洗与编码解码
- IPSecVPN介绍 &; (Cisco Packet Tracer)IPSecVPN实验演示
- vue移动端记录列表滚动如何快速找到是哪个元素产生的滚动
- vue项目中视频播放结束返回首页出现1秒左右的白屏问题
- 解决SpringBoot项目创建缓慢问题