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