4

分享一个我写的容器里的 top 命令: topic (top in container)

 1 year ago
source link: https://www.v2ex.com/t/884157
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

V2EX  ›  分享创造

分享一个我写的容器里的 top 命令: topic (top in container)

  silenceshell · 8 小时 35 分钟前 · 751 次点击

容器里运行的 top 命令是从宿主机获取的指标(比如 uptime ,users ,load ,task ,cpu ,memory ),而在大规格物理机上运行的容器通常会设置 limit (例如 4c8G ),top 命令查看到物理机的运行信息,而不是容器的运行信息,对于用户会有误导。

topic ( top in container )从容器里获取这些指标,并展示出来,可以将 topic 的二进制打到容器镜像里,这样无论容器运行在哪里,都可以方便(并准确的)的查看容器的 top 运行指标。

Github:https://github.com/silenceshell/topic

下图展示了在物理机上的 2c2G 的容器里,运行 stress --cpu 2 ,通过 topic 查看到的输出。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK