Monitor Proxmox ด้วย Glances

Monitor Proxmox ด้วย Glances

หลังจากย้าย home assistant มาติดตั้ง VM บนตัว proxmox ก็ใช้งานได้ดี แต่สิ่งที่อยากได้เพิ่มเติมคือการ monitor proxmox ซึ่งถ้าใช้งานผ่านทาง web ui ของ proxmox ก็จะมี monitor dashboard ให้เราดูอยู่แล้ว แต่ถ้าเราอยากดูผ่านทาง home assistant ?!

สำหรับตัว monitor tool ที่เราเลือกใช้คือ Glances เพราะมันสามารถเชื่อม integrations เข้ากับ home assistant ได้ง่ายมาก และมี entity sensor ที่จำเป็นมาเยอะพอสมควร

เริ่มต้นให้เข้าไป shell ของ proxmox เพื่อจะทำการติดตั้ง glances

rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED
กรณีใช้งาน Proxmox PV 8 ให้รันคำสั่งข้างบนก่อน
curl -L https://bit.ly/glances | /bin/bash

การติดตั้ง glances ใช้เวลาพอสมควร เมื่อติดตั้งเสร็จ ให้ทำการสร้าง username และ password

glances -w --username --password

กำหนด username, password และทำการยืนยัน password อีกครั้ง จากนั้นตอบ yes เพื่อทำการ save password

ทดสอบเข้าใช้งาน glances ผ่านทาง web ui ด้วย http://{IP_HOST}:61208/

CTRL+C ออกจาก glances service เพื่อจะไปรันแบบ glances.service

nano /etc/systemd/system/glances.service

copy คำสั่งไปวาง จากนั้นทำการ save (CTRL+X และ Y)

[Unit]
Description=Glances
After=network.target

[Service]
ExecStart=/usr/local/bin/glances -w
Restart=on-abort
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

ทำการ enable service และก็ start service

systemctl enable glances.service
systemctl start glances.service

เข้าไปที่ home assistant ทำการ add integrations ค้นหา "Glances" กรอกข้อมูล

  • Host (ip ของ proxmox)
  • username
  • password

ตอนนี้เราก็สามารถ monitor proxmox ผ่านทาง home assistant ได้แล้ว!