yum install epel* -y
yum install python-pip python-devel -y
yum install glances -y
yum install iftop -y
yum install htop -y
#glances
WebServer 模式
在 glances 的 WebServer 模式下,客户端只通过浏览器访问就可以获取远程服务器的运行状态。该模式需要额外安装 Python 的 Bottle 模块:
pip install bottle
安装成功后,使用 glances -w
命令即可开启 WebServer 模式。
客户端使用浏览器访问 http://SERVER_IP:61208/
进入监控界面。
将 WebServer 模式配置为系统服务
1.创建 Unit 文件sudo vim /etc/systemd/system/glancesweb.service
文件内容如下:
[Unit] Description = Glances in Web Server Mode After = network.target [Service]
# glances路径因安装方法不同根据实际情况确定,可使用 which glances 命令获取
ExecStart = /usr/bin/glances -w -t 5
[Install]
WantedBy = multi-user.target
2. 启用 systemd 服务并运行
systemctl enable glancesweb
systemctl start glancesweb
systemctl status glancesweb