zabbix、netdata和glances,做最简单的系统资源监控

软件需要显示服务器的资源信息(CPU、内存、网络、硬盘等),但是软件是在Docker容器中运行。

目前方案

通过ssh在主机上远程运行ps、free等指令,获取相应的信息。这种方案需要代码配置主机的IP,以及用户名和密码,一方面对于安全性来说不好,另一方面容器和主机通过IP进行了耦合,所以想看看有没有其他的方案。
要求:

  1. 开源
  2. 可以本地部署,也可以容器部署
  3. 在容器中部署,可以监控主机的资源
  4. 对系统资源占用的越小越好
  5. 需要支持ARM架构

zabbix

Zabbix:企业级开源监控解决方案
功能非常齐全,手册非常详细。
server没有windows版本,agent有windows版本;
但是zabbix感觉有些重,需要部署多个容器。

glances

nicolargo/glances: Glances an Eye on your system. A top/htop alternative for GNU/Linux, BSD, Mac OS and Windows operating systems.
glance是python编写的轻量级系统监控,可以命令行交互,也可以web交互,对系统资源的占用非常小。它是基于psutil开发的,psutil可以在容器中获取主机信息,参考:Allow specifying /proc and other needed folders · Issue #558 · giampaolo/psutil,以及psutil inside docker container reports host stats · Issue #1011 · giampaolo/psutil

但是看了一下glances的代码,发现其中把“/proc”路径写死在代码中
在这里插入图片描述
如果想在容器中监控主机资源,就需要把所有的“/proc/”硬编码改为变量,有些犯懒了,不想改。
可以考虑使用psutil修改原来的代码,这样可以不用保存密码和主机IP,应该也能解决问题。

也可以考虑把对应的文件从主机映射到容器中,例如:如果要检测主机的启动时间-v /proc/uptime:/proc/uptime:ro
但是有些文件如果从主机映射到容器,可能会影响容器的运行,这个就需要一个一个测试了。

netdata

Learn Netdata
netdata基本功能开源,高级功能收费,部署较为简单(一个容器即可),对系统的资源占用可以根据开启的功能优化,
计划使用netdata作为系统资源监控方案

CPU:As a general rule, for modern hardware and VMs, the total CPU consumption of a standalone Netdata installation, including all its components, should be below 5 - 15% of a single core. For example, on 8 core server it will use only 0.6% - 1.8% of a total CPU capacity, depending on the CPU characteristics.
Memory:The memory footprint of Netdata is mainly influenced by the number of metrics concurrently being collected. Expect about 150MB of RAM for a typical 64-bit server collecting about 2000 to 3000 metrics.
Disk:By default, Netdata should not use more than 1GB of disk space, most of which is dedicated for storing metric data and metadata. For typical installations collecting 2000 - 3000 metrics, this storage should provide a few days of high-resolution retention (per second), about a month of mid-resolution retention (per minute) and more than a year of low-resolution retention (per hour).

How to optimize the Netdata Agent’s performance | Learn Netdata
上面的网址中有netdata对系统资源占用的评估,以及优化的说明

netdata好像还没有windows的版本,但是有windows的exporter,Windows Monitoring

这是我的设置:
在这里插入图片描述
在这里插入图片描述

  • 6
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值