Skip to content
tashirka1Public

About

Server monitoring tool for processes, containers, and system metrics. Built with Go + Echo, htmx + templ + PicoCSS, SQLite.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

K2

Server monitoring tool for processes, containers, and system metrics. Built with Go + Echo, htmx + templ + PicoCSS, SQLite.

Table of Contents

Features

Feature Description
System monitoring CPU, memory and disk usage tracking
Process monitoring CPU, memory usage and RAM consumption per process
Container monitoring CPU and memory metrics per Docker container
Historical data Persistent storage of system, process and container metrics with retention and automatic cleanup
History charts Interactive charts with selectable periods (1 hour to 30 days)
Live updates Auto-refreshing interface with configurable interval
Search and filtering Quick search across processes, containers and resources
Sorting Sortable tables by name, CPU, memory and other fields
Authentication Secure login with session management and lockout on failed attempts
Configuration Environment-based setup with in-app configuration viewer
Deployment Single binary with no dependencies; supports systemd and Docker

Install

Bare-metal (systemd)

curl -fsSL https://raw.githubusercontent.com/tashirka1/k2/main/scripts/install.sh | sudo bash

The script downloads the latest release binary, installs it to /usr/local/bin/k2, and sets up a systemd service. Data lives in /opt/k2:

Note: the prebuilt binary is available only for linux-amd64 (Linux x86_64). On other platforms the installer aborts with a warning — build from source or use Docker instead.

  • /opt/k2/k2.env — environment configuration (generated on first install)
  • /opt/k2/k2.db — SQLite database

Re-running the script wipes previous data in /opt/k2 and reinstalls a fresh instance.

Docker

Clone repository

cp env-example .env
make up

The container runs on port 8000, mapped to the host via K2_EXTERNAL_PORT (default 9000). The ./db/ directory and .env are mounted for persistence.

From source (go install)

go install github.com/tashirka1/k2/cmd/k2@latest

Installs the k2 binary to your GOBIN (usually ~/go/bin). Requires Go and internet access to fetch the latest release.

Run as a systemd service

Create a config file and the database directory:

sudo mkdir -p /opt/k2
sudo cp env-example /opt/k2/k2.env
sudoedit /opt/k2/k2.env   # set K2_SESSION_KEY, K2_USERNAME, K2_PASSWORD

Create /etc/systemd/system/k2.service (replace ExecStart with your GOBIN path, see go env GOBIN):

[Unit]
Description=K2 server monitoring
After=network.target

[Service]
Type=simple
ExecStart=/home/user/go/bin/k2
WorkingDirectory=/opt/k2
EnvironmentFile=/opt/k2/k2.env
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target

Start the service:

sudo systemctl daemon-reload
sudo systemctl enable --now k2

Development

Clone repository

cp env-example .env
make dev   # run dev server with autoreload (air)

Build

Clone repository

cp env-example .env
make build-bin          # dev binary to bin/k2
make build-linux-amd64  # static release binary to bin/k2-linux-amd64
make check              # lint + format + tests

Configuration

Create a .env file in the project root (see env-example):

Variable Default Description
K2_SESSION_KEY (required) Session signing key
K2_PORT 8000 Server listen port
K2_EXTERNAL_PORT 9000 Host port for Docker (compose only)
K2_DB_NAME ./db/k2.db SQLite database path
K2_USERNAME — Admin username
K2_PASSWORD — Admin password
K2_COLLECT_INTERVAL 30s Metrics collection interval
K2_RETENTION 168h How long metrics are kept before purging

Usage

k2 — start the server. k2 credentials — print the admin username and password.

Screenshots

K2 system dashboard

K2 processes dashboard

K2 containers dashboard

About

Server monitoring tool for processes, containers, and system metrics. Built with Go + Echo, htmx + templ + PicoCSS, SQLite.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Contributors

Languages