linux - 在日志文件中捕获 nethogs 输出

标签 linux bash

我想检查我的进程使用的网络带宽。 为此,我发现 nethogs 工具很有用。使用这个工具,我可以看到哪个进程正在消耗网络带宽和进程行为。 但是我如何从 nethogs 为我的进程捕获数据并将其存储到日志文件中?

最佳答案

您可以在后台以跟踪模式运行 nethogs 并将输出写入如下文件:

sudo nethogs -t eth1 &> /var/tmp/nethogs.log & 

按照 here 所述下载并构建 nethogs-parser .

然后在您积累了足够的数据之后,您可以运行解析器来查看结果:

./hogs -type=pretty /var/tmp/nethogs.log 

确保在完成数据收集后终止正在运行的 nethogs 进程。

更多信息 here关于自动化任务。

关于linux - 在日志文件中捕获 nethogs 输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20702980/

相关文章:

linux - 为什么我得到 "svn: command not found"

bash - SCRIPT_PATH ="${BASH_SOURCE[0]}"替换错误

php - 从可靠的系统来源自动检测时区

c - libiptc : adding DNAT rule with destination IP

linux - QEMU-KVM性能优化

linux - 使用 Getopts 传递多个强制标志的问题

linux - 使用 crontab 自动编写脚本

python - 带有 Python 2.6 的 Anaconda Python

linux - 在 Linux 11.04 上安装 TBB

bash - shell 脚本 grep 来 grep 一个字符串