Last active
August 19, 2025 14:49
-
-
Save muness/d9995d1d8a32b6b4de3f19c2bc518308 to your computer and use it in GitHub Desktop.
Install glances including GPU and web server plugins
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mkdir -p ~/.config/glances | |
| cat > ~/.config/glances/glances.conf <<EOF | |
| [global] | |
| # enable the GPU plugin for both CLI & Web | |
| gpu = True | |
| # optionally toggle the Sensors section on by default | |
| show_sensors = True | |
| [webserver] | |
| # make sure the Web UI will include the sensors/GPU panel | |
| export_gpu = True | |
| EOF |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo tee /etc/systemd/system/glances.service > /dev/null << 'EOF' | |
| [Unit] | |
| Description=Glances HTTP Server (CPU + GPU monitoring) | |
| After=network-online.target | |
| Wants=network-online.target | |
| [Service] | |
| Type=simple | |
| User=audiolinux | |
| WorkingDirectory=/home/audiolinux | |
| ExecStart=/home/audiolinux/glances-venv/bin/glances -w --bind 0.0.0.0 | |
| Restart=on-failure | |
| RestartSec=5s | |
| [Install] | |
| WantedBy=multi-user.target | |
| EOF | |
| sudo chmod 644 /etc/systemd/system/glances.service | |
| sudo systemctl daemon-reload | |
| sudo systemctl enable glances.service | |
| sudo systemctl start glances.service |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| ## Suitable for Arch Linux. | |
| ## I am using this under AudioLinux v4 to observe HQPlayer Desktop performance. | |
| set -euo pipefail | |
| # 1. Ensure we have python3-venv and pip available | |
| echo "Installing python3-venv (if missing)…" | |
| sudo pacman -Sy --noconfirm python-virtualenv python-pip | |
| # 2. Create a venv in ~/glances-venv (if it doesn't already exist) | |
| VENV_DIR="$HOME/glances-venv" | |
| if [[ -d "$VENV_DIR" ]]; then | |
| echo "==> Virtualenv already exists at $VENV_DIR, skipping creation." | |
| else | |
| echo "==> Creating Python venv at $VENV_DIR…" | |
| python3 -m venv "$VENV_DIR" | |
| fi | |
| # 3. Activate the venv | |
| echo "==> Activating venv…" | |
| # shellcheck source=/dev/null | |
| source "$VENV_DIR/bin/activate" | |
| # 4. Upgrade pip & setuptools inside the venv | |
| echo "==> Upgrading pip & setuptools in the venv…" | |
| pip install --upgrade pip setuptools | |
| # 5. Install Glances + NVIDIA plugin dependencies | |
| echo "==> Installing Glances + GPU support…" | |
| pip install glances gpustat py3nvml uvicorn fastapi jinja2 | |
| # 6. Verify installation | |
| echo "==> Verifying Glances and GPU plugin…" | |
| if ! command -v glances >/dev/null 2>&1; then | |
| echo "ERROR: 'glances' not found in venv PATH." >&2 | |
| exit 1 | |
| fi | |
| echo | |
| echo "=======================================================" | |
| echo "✅ Glances and GPU‐monitoring plugins are installed." | |
| echo " To run Glances as a web server, execute:" | |
| echo | |
| echo " source \"$VENV_DIR/bin/activate\"" | |
| echo " glances -w --bind 0.0.0.0" | |
| echo | |
| echo " Then point your browser to:" | |
| echo | |
| echo " http://<this-machine-IP>:61208/" | |
| echo | |
| echo " (Press Ctrl+C in this shell to stop Glances.)" | |
| echo "=======================================================" | |
| echo | |
| # 7. (Optional) auto-launch now | |
| read -r -p "Do you want to start Glances web server right now? [y/N] " yn | |
| case "$yn" in | |
| [Yy]* ) | |
| echo "Starting Glances in web mode…" | |
| glances -w --bind 0.0.0.0 | |
| ;; | |
| * ) | |
| echo "Skipping auto-start. You can run 'glances -w --bind 0.0.0.0' later." | |
| ;; | |
| esac | |
| # 8. Deactivate venv (if it’s still active) | |
| deactivate 2>/dev/null || true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment