|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+# sever-monitor v1.0
|
|
|
2
|
+
|
|
|
3
|
+#### mqtt服务器默认端口:127.0.0.1:1883
|
|
|
4
|
+
|
|
|
5
|
+#### 主题:server-status,5秒钟采集一次发送到服务器
|
|
|
6
|
+
|
|
|
7
|
+**以上都是默认配置可自己修改源码**
|
|
|
8
|
+
|
|
|
9
|
+- 通过C语言实现的采集内存、cpu使用情况、cpu温度、硬盘温度。
|
|
|
10
|
+
|
|
|
11
|
+- cpu温度通过读取liux内核伪文件获得:"/sys/class/hwmon/hwmon1/temp3_input"。
|
|
|
12
|
+
|
|
|
13
|
+- 硬盘温度通过通过Smartmontools api获取。
|
|
|
14
|
+
|
|
|
15
|
+- CPU使用率通过读取linux内核伪文件计算获得:"/proc/stat"。
|
|
|
16
|
+
|
|
|
17
|
+- 内存使用率通过读取linux内核伪文件计算获得:"/proc/meminfo"。
|
|
|
18
|
+
|
|
|
19
|
+> 需要安装的依赖:mosquitto客户端、emqx或mosquitto服务器、Smartmontools ,测试基于centos7.9
|
|
|
20
|
+
|
|
|
21
|
+**运行效果**:
|
|
|
22
|
+
|
|
|
23
|
+
|
|
|
24
|
+
|
|
|
25
|
+
|
|
|
26
|
+
|
|
|
27
|
+- **shell启动命令**:
|
|
|
28
|
+
|
|
|
29
|
+Usage: sever-monitor /dev/sda
|
|
|
30
|
+
|
|
|
31
|
+
|
|
|
32
|
+
|