Skip to content

erysngl/ZeroStat-Go

Repository files navigation

🇺🇸 English | 🇹🇷 Türkçe
Go Version HTMX Tailwind CSS Docker Ready

Logo ZeroStat-Go

Ultra-Lightweight System & Network Dashboard

screnshot (2)
screnshot (1) screnshot (3)

Overview

ZeroStat-Go is a high-performance, minimalist server resource dashboard engineered for maximum efficiency. It completely eschews heavy JavaScript frameworks in favor of Go, HTMX, and Tailwind CSS, providing real-time infrastructure visibility with an incredibly tiny footprint. It doesn't just monitor, it intervenes.

Monitor your CPU, Memory, Disk capacity, and active Network I/O (in precise KB/s) without taxing the hardware you are trying to observe.

Demo

Experience a live preview of the ZeroStat-Go dashboard interface without running a server: 👉 Launch Live Demo

Key Features

  • Blazing Fast Backend: Powered by a statically compiled Go binary utilizing gopsutil.
  • Zero-JS-Framework Frontend: Binds Go templating directly to HTMX for seamless, partial-page updates.
  • Active Task Manager: Monitor host processes and their mapped Docker containers in real-time. Instantly intervene by killing rogue processes or halting resource-hogging containers natively from the UI.
  • Dynamic Theming: Built-in Light and Dark mode toggles leveraging Tailwind CSS.
  • Secure Access: Robust session-based authentication guarding your metrics layer.
  • KB/s Network Tracking: Live Rx/Tx network speed tracking scaled dynamically.
  • Dynamic Configuration: Adjust listening ports (default 9124), passwords, and themes post-deployment via an integrated settings panel.
  • i18n Support: First-class support for English and Turkish locales.
  • Cloud Native: Arrives with an optimized, multi-stage Alpine Dockerfile clocking in at under 20MB.

Smart Automation Engine & Alerting

ZeroStat-Go features a powerful, built-in automation engine that evaluates your system metrics against user-defined thresholds safely in the background.

  • Advanced Alerting Logic: Setup CPU, RAM, and Network (KB/s) threshold monitoring with second-based sustain durations (Duration) to prevent false positives, alongside spam-prevention timeout windows (Cooldown).
  • Multi-Channel Notifications: Automatically dispatch alerts via the integrated Telegram Bot, customizable Webhooks, or SMTP Email.
  • Dynamic Messaging: Craft smart notification templates using context-aware placeholders like {hostname}, {metric}, {value}, and {duration} to provide deep context when a guardrail is breached.
  • Safe Execution: Automate shell commands (e.g., docker stop $(docker ps -q)) safely using a vetted sandbox environment without freezing the main process thread.

Architecture

  • Language: Go (Golang)
  • Frontend: HTMX + HTML/Templates
  • Styling: Tailwind CSS (via CDN to eliminate node_modules overhead)
  • OS Interfacing: shirou/gopsutil
  • State/Routing: Native net/http + gorilla/sessions

Configuration

ZeroStat-Go handles configuration initially via environment variables (falling back to secure defaults), which can later be mutated via the web dashboard.

  1. Copy the example configuration:
    cp .env.example .env
  2. Adjust your variables:
    ZEROSTAT_PORT=9124
    ZEROSTAT_PASSWORD=your_secure_password
    SESSION_SECRET=your_32_byte_session_secret
    
    # Notification Settings
    TG_BOT_TOKEN=your_telegram_bot_token
    TG_CHAT_ID=your_telegram_chat_id
    WEBHOOK_URL=https://your-webhook.com/endpoint

Installation & Deployment

Method 1: Docker Deployment (Recommended)

The most robust way to run ZeroStat-Go, mapping host metrics accurately into the container. Save the following content as docker-compose.yml:

services:
  zerostat:
    image: ghcr.io/erysngl/zerostat-go:latest
    container_name: zerostat-dashboard
    restart: unless-stopped
    ports:
      - "9124:9124"
    environment:
      - ZEROSTAT_PASSWORD=admin
    pid: host
    volumes:
      - /proc:/host/proc:ro
      - /sys:/host/sys:ro
      - /:/host/root:ro
      - /var/run/docker.sock:/var/run/docker.sock # Recommended for System Management
      - ./.env:/app/.env
      - ./data:/app/data

Before starting, ensure you create an empty .env file and a data directory first to prevent Docker from misinterpreting the mounts:

touch .env
mkdir data

⚠️ CRITICAL MOUNTS FOR TASK MANAGER: To enable the Active Task Manager to accurately read host process CPU/RAM statistics and pinpoint precisely which Docker container a process belongs to, you MUST include both - /proc:/host/proc:ro and - /var/run/docker.sock:/var/run/docker.sock in your volume binds.

Then, launch the system and access your dashboard:

  1. Bring up the container in the background:
    docker-compose up -d
  2. Navigate to http://localhost:9124 in your browser.

Data Persistence

ZeroStat-Go allows you to configure settings like your Port, Admin Password, and Telegram/Webhook credentials dynamically through the web UI's Settings panel, while your active rules are controlled through the Automation panel.

By mapping the .env file (- ./.env:/app/.env) and the data/ directory (- ./data:/app/data) as shown in the docker-compose snippet, you enforce Full Data Persistence:

  1. Application Settings: Written instantly to .env upon save.
  2. Automation Rules: Instantly serialized to data/rules.json upon adding, deleting, or toggling conditions.

Consequently, if your Docker container is updated, rebuilt, or deleted, your settings and threshold configurations will not be lost. They will be safely reloaded on boot.

Method 2: Native Build

Assuming you have Go 1.21+ installed:

# Clone the repository
git clone https://github.com/yourusername/zerostat.git
cd zerostat

# Fetch dependencies
go mod tidy

# Build the executable
go build -ldflags="-s -w" -o zerostat ./cmd/zerostat

# Run the daemon (Accessible via http://localhost:9124)
./zerostat

Security

ZeroStat-Go protects the dashboard endpoint behind a highly secure, HTTP-only cookie session mechanism (SameSite=Lax). The default password is admin (or defined in your .env). It is highly recommended to change this immediately upon first login via the Settings panel or your .env file before exposing port 9124 to the public internet. Furthermore, malformed cookies are handled gracefully by safely clearing sessions rather than throwing errors.

License

This project is licensed under the MIT License.


ERYSNGL | Github

About

ZeroStat-Go: Lightweight monitoring powered by a smart automation engine. Define custom thresholds to trigger shell commands, execute auto-remediations, and send instant Telegram/Webhook alerts with cooldown logic.

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Packages

 
 
 

Contributors