====== Glances ======
[[https://github.com/nicolargo/glances|Glances]] is a CLI and Web GUI monitor for your server. It's neat and nice, and it's not intrusive. It comes with a nice CLI interface, but also with an handy WEB GUI interface, which is what i want to leverage here.
Note: i stopped using Glances because it had a visible impact on my server performances.
==== Installation ====
Glances is available in Gentoo's Portage, but lacks the FastAPI and Uvcorn dependencies, so it's better to create a dedicated venv as root:
python -m venv /opt/glances
. /opt/glances/bin/activate
pip install glances fastapi uvicorn jinja2
==== Reverse Proxy ====
Glances needs to be set up in the [[selfhost:nginx|reverse proxy]] to be accessed protected behind your [[selfhost:sso|SSO]]:
location = /glances {
return 301 https://$host/glances/;
}
location /glances/ {
rewrite /glances/(.*) /$1 break;
proxy_pass http://localhost:61208/;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
==== Autostart ====
Create the following OpenRC start script into **/etc/init.d/glancesweb** and make it exetuable:
#!/sbin/openrc-run
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
description="Glances web server"
pidfile="/run/glancesweb.pid"
logfile="/var/log/glancesweb.log"
depend() {
need net
}
start() {
. /opt/glances/bin/activate
/opt/glances/bin/glances -w > ${logfile} 2> ${logfile}&
echo $! > ${pidfile}
}
Then of course, set it to boot:
rc-update add glancesweb default