Skip to main content

Lightweight monitoring adapter bridging Glances metrics with Uptime Kuma

Project description

GlanceWatch

Python 3.8+ FastAPI License: MIT PyPI version Tests Coverage

GlanceWatch is a lightweight monitoring adapter that bridges Glances system metrics with Uptime Kuma and other monitoring tools. It exposes simple HTTP endpoints with configurable thresholds that answer: "Is my system healthy?"

Features

  • One-Command Install: pip install glancewatch - everything included
  • Auto-Glances Management: Automatically installs and starts Glances for you
  • HTTP Status Alerting: Returns HTTP 200 (OK) or 503 (unhealthy) based on thresholds
  • Router-Style Web UI: Clean admin interface at / (root)
  • Configurable Thresholds: Set custom limits for RAM, CPU, and disk usage
  • Persistent Configuration: Changes saved to config.yaml automatically
  • Multiple Disk Monitoring: Monitor all or specific mount points
  • Health Checks: Built-in health endpoint for service monitoring
  • OpenAPI Docs: Auto-generated API documentation at /api
  • Real-Time Metrics: Auto-refreshing dashboard shows live system status

Installation

macOS (Homebrew)

brew tap collynes/glancewatch
brew install glancewatch
glancewatch

Windows (Chocolatey)

choco install glancewatch
glancewatch

Node.js/npm (All platforms)

# Global installation
npm install -g glancewatch
glancewatch

# Or use npx
npx glancewatch

Python/pip (All platforms)

pip install glancewatch
glancewatch

Quick Start

Background Service (Recommended for Production)

Linux/Ubuntu (systemd):

# One-command install as background service
curl -sSL https://raw.githubusercontent.com/collynes/glancewatch/main/scripts/install-pip.sh | bash

# Service automatically starts on boot and runs in background

Simple background start (nohup):

# Start in background
nohup glancewatch > /dev/null 2>&1 &

# Check if running
ps aux | grep glancewatch

See docs/BACKGROUND-SERVICE.md for complete guide including screen/tmux options.

Foreground (Development)

# Run GlanceWatch (auto-starts Glances if needed)
glancewatch

# Access the web UI
open http://localhost:8765

That's it! 🎉 GlanceWatch automatically handles Glances installation and startup.

Usage

# Start GlanceWatch (auto-starts Glances)
glancewatch

# Start without auto-starting Glances
glancewatch --ignore-glances

# Custom port
glancewatch --port 9000

# Custom host
glancewatch --host 0.0.0.0

📚 Documentation

📡 API Endpoints

  • GET / - Web UI (root endpoint)
  • GET /status - Combined status (HTTP 503 on threshold violation)
  • GET /ram - RAM usage check
  • GET /cpu - CPU usage check
  • GET /disk - Disk usage check
  • GET /health - Service health check
  • GET /config - Get configuration
  • PUT /config - Update thresholds
  • GET /docs - Interactive API documentation

🔔 Uptime Kuma Integration

  1. In Uptime Kuma, create a new HTTP(s) monitor
  2. Set URL to: http://your-server:8765/status
  3. Set "Accepted Status Codes" to: 200

When any metric exceeds its threshold, GlanceWatch returns HTTP 503, triggering an alert.

Configuration

GlanceWatch creates ~/.config/glancewatch/config.yaml:

glances_base_url: "http://localhost:61208/api/4"
host: "0.0.0.0"
port: 8765
log_level: "INFO"
return_http_on_failure: 503

thresholds:
  ram_percent: 80
  cpu_percent: 80
  disk_percent: 85

disk:
  mounts:
    - "/"

Adjust thresholds via the Web UI at / or edit the config file.

🧪 Testing & Development

GlanceWatch has comprehensive test coverage to ensure reliability:

Running Tests

# Install development dependencies
pip install -e ".[dev]"

# Run all tests
pytest tests/ -v

# Run with coverage report
pytest tests/ --cov=app --cov-report=html

# Run specific test file
pytest tests/test_api.py -v

# Run and stop on first failure
pytest tests/ -x

Test Coverage

  • 78%+ code coverage with 63+ test cases
  • All endpoints tested (including new /thresholds endpoints)
  • CLI functionality tests
  • Error handling and edge cases
  • Integration workflow tests

CI/CD

Every push and pull request automatically runs:

  • ✅ Tests on Python 3.8, 3.9, 3.10, 3.11, 3.12
  • ✅ Code linting
  • ✅ Coverage checks (minimum 75%)
  • ✅ Package build verification

See docs/TEST_SUMMARY.md for detailed test documentation.

🆕 What's New in v1.2.1

  • Dynamic Version Display: Fixed version display bug - now shows correct version in UI
  • Template-based Version: Uses {{VERSION}} placeholder replaced at runtime
  • Improved UI: Green/red circle status indicators with thin borders
  • System Health Monitor: Added uptime, load average, and network statistics
  • Better Thresholds: CPU now supports 0.1% minimum threshold
  • Reset Defaults: Reset button always enabled with proper default values (80/80/85)
  • Clean Documentation: Removed all unsolicited emojis from docs
  • Section Reordering: Moved threshold configuration before system health

See docs/RELEASE_NOTES_v1.2.1.md for complete release notes.

📄 License

MIT License - see LICENSE file for details.

📧 Support


Made with ❤️ for simple system monitoring

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

glancewatch-1.2.2.tar.gz (609.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

glancewatch-1.2.2-py3-none-any.whl (588.7 kB view details)

Uploaded Python 3

File details

Details for the file glancewatch-1.2.2.tar.gz.

File metadata

  • Download URL: glancewatch-1.2.2.tar.gz
  • Upload date:
  • Size: 609.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for glancewatch-1.2.2.tar.gz
Algorithm Hash digest
SHA256 24b47a549adfb8c94a08042d1070a2a7dfe946d337a8814b2e8622ace9d03a9e
MD5 9073b641dea8a93b2fadd58852876ca3
BLAKE2b-256 3ded8d8753dad134c04d233ad6bc74091fbeec63eb69ffbaa9745254ad893346

See more details on using hashes here.

File details

Details for the file glancewatch-1.2.2-py3-none-any.whl.

File metadata

  • Download URL: glancewatch-1.2.2-py3-none-any.whl
  • Upload date:
  • Size: 588.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for glancewatch-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b727b3c78119bb2e026091f7d0e51e9a6d87fc2158683e2441e1d23b27d2797d
MD5 8092f96b6db934cdc6c1fa77c7dfdad1
BLAKE2b-256 587a8dc5f878fcd8dac462c2c460c7e265fff889b9b90a4ab6ca70993edfcab4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page