| 一般的人都是把HA安装在PI上,或者群辉上,都是和主机安装在一起的,这样的监控主机信息可以使用systemointor即可,在configuration.yaml文件中加入: 
 
sensor:
  - platform: systemmonitor
    resources:
      - type: disk_use_percent
        arg: /home #home文件夹的容量使用
      - type: memory_free   #剩余的内存
 
 
 那如果我把HA装在PI上,想要显示另一台群晖的使用情况呢?用什么呢?今天就来推荐这个----glances
 
 首先在需要被监控的机器上安装glances,安装的命令也很简单:
 
 
pip install glances
#某些情况下可能还会用到 psutil
pip install  psutil
 
 安装成功后在终端输入:
 
 
sudo glances -w
#显示如下信息即表示运行成功
Glances web server started on [url]http://0.0.0.0:61208/[/url]
 
 在/etc/systemd/system/文件夹中创建glances.service
 
 
[Unit]
Description=Glances
[Service]
ExecStart=/usr/local/bin/glances -w
Restart=on-abort
[Install]
WantedBy=multi-user.target
 
 启动服务:sudo systemctl start glances.service
 随机启动:sudo systemctl enable glances.service
 
 这时就可以通过同一局域网的其他机子来访问http://<glances_ip>:61208
 就可以看到如下的界面:
 
 
 接下去就可以在configuration.yaml文件中配置了:
 
 
sensor:
  - platform: glances
    host: IP_ADDRESS
    resources:
      - 'disk_use_percent'
      - 'disk_use'
      - 'disk_free'
      - 'memory_use_percent'
      - 'memory_use'
      - 'memory_free'
      - 'swap_use_percent'
      - 'swap_use'
      - 'swap_free'
      - 'processor_load'
      - 'process_running'
      - 'process_total'
      - 'process_thread'
      - 'process_sleeping'
      - 'cpu_temp'
 
 对不起,没有配置好的文件,根据自己的需求选择选项即可
 
 |