You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17607550577 17c882b4d6 first commit 4 anni fa
Makefile first commit 4 anni fa
readme.md first commit 4 anni fa
server-monitor first commit 4 anni fa
server-monitor.c first commit 4 anni fa

readme.md

sever-monitor v1.0

mqtt服务器默认端口:127.0.0.1:1883

主题:server-status,5秒钟采集一次发送到服务器

以上都是默认配置可自己修改源码

  • 通过C语言实现的采集内存、cpu使用情况、cpu温度、硬盘温度。

  • cpu温度通过读取liux内核伪文件获得:“/sys/class/hwmon/hwmon1/temp3_input”。

  • 硬盘温度通过通过Smartmontools api获取。

  • CPU使用率通过读取linux内核伪文件计算获得:”/proc/stat”。

  • 内存使用率通过读取linux内核伪文件计算获得:”/proc/meminfo”。

需要安装的依赖:mosquitto客户端、emqx或mosquitto服务器、Smartmontools ,测试基于centos7.9

运行效果

image-20210514194651090

image-20210514194742287

  • shell启动命令

Usage: sever-monitor /dev/sda

image-20210514194848828