linux下的一些监控资源工具介绍

韵味老鸟 2024-08-15 13:49:00

linux下的一些监控资源工具介绍

可以用来监控 Linux 系统中进程的 CPU、内存和 I/O 使用情况:

top - 最基本和常用的命令行工具,可以实时显示系统中进程的 CPU 和内存使用情况

htop - top 的增强版,提供更友好的用户界面和更多功能,可以显示 CPU、内存、交换分区使用情况

atop - 高级系统和进程监视器,可以显示 CPU、内存、磁盘和网络性能

glances - 跨平台的监控工具,除了 CPU 和内存外,还可以监控文件系统 I/O、网络 I/O 等

nmon - 系统管理员调优和基准测试工具,可以显示 CPU、内存、网络、磁盘、文件系统等性能指标

iotop - 专门用于监控 I/O 使用情况的工具,可以显示进程的 I/O 读写速度

nethogs - 按进程实时显示网络带宽使用情况

vmstat - 报告系统内存、进程、中断、分页、块 I/O 等统计信息

二:nethogs网络工具

root@uk8s:~/.ssh# apt install nethogs

正在读取软件包列表... 完成

正在分析软件包的依赖关系树... 完成

正在读取状态信息... 完成

下列【新】软件包将被安装:

nethogs

升级了 0 个软件包,新安装了 1 个软件包,要卸载 0 个软件包,有 6 个软件包未被升级。

需要下载 29.9 kB 的归档。

解压缩后会消耗 86.0 kB 的额外空间。

获取:1 http://mirrors.aliyun.com/ubuntu focal/universe amd64 nethogs amd64 0.8.5-2build2 [29.9 kB]

已下载 29.9 kB,耗时 0秒 (85.5 kB/s)

正在选中未选择的软件包 nethogs。

(正在读取数据库 ... 系统当前共安装有 124739 个文件和目录。)

准备解压 .../nethogs_0.8.5-2build2_amd64.deb ...

正在解压 nethogs (0.8.5-2build2) ...

正在设置 nethogs (0.8.5-2build2) ...

正在处理用于 man-db (2.10.2-1) 的触发器 ...

Scanning processes...

Scanning linux images...

Running kernel seems to be up-to-date.

No services need to be restarted.

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.

执行命令:nethogs

nethogs --help

qroot@uk8s:~/.ssh# nethogs --help

nethogs: invalid option -- '-'

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

0 阅读:0