Skip to content

kCn3333/server-stats

Repository files navigation

Lightweight server monitoring API and SVG badge.

Build Docker Pulls Python FastAPI

Features

  • Exposes basic host metrics via HTTP:
    • uptime
    • CPU usage & load
    • RAM usage
    • average CPU temperature
  • Renders a live SVG status badge
  • Optimized for low overhead and edge caching

Endpoints

  • GET /metrics – JSON metrics
  • GET /badge.svg – embeddable SVG badge

Example badge usage:

server status

JSON:

{
    "uptime_seconds": 1064790,
    "uptime_human": "12d 7h 46m",
    "cpu": {
        "percent": 15.8,
        "load_1m": 0.5869140625
    },
    "ram": {
        "used_mb": 9773,
        "total_mb": 15819,
        "percent": 61.8
    },
    "temperature": {
        "cpu_avg": 46.5
    }
}

Design goals

  • Minimal CPU & memory usage
  • No agents, no background loops
  • Read-only access to host (/proc, /sys)
  • Edge-cached via Cloudflare (s-maxage=15)
  • Restricted CORS (suffix-based, configurable)

Deployment

Built and published automatically via GitHub Actions:

Docker image: kcn333/server-stats

Quick Start

docker-compose.yml:

services:
  server-stats:
    image: kcn333/server-stats:latest
    ports:
      - "8000:8000"
    volumes:
      - /proc:/host/proc:ro
      - /sys:/host/sys:ro
    environment:
      ALLOWED_CORS_SUFFIX: ".domain.com"

License

MIT

About

Lightweight server monitoring API and SVG badge.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published