Skip to content

Latest commit

 

History

22 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kronika

Русская версия

Kronika records Linux metrics, PostgreSQL statistics, query plans and events from PostgreSQL/PgBouncer logs. The collector runs on the monitored Linux machine or records only PostgreSQL data from a local or remote server. The web interface shows resource use, processes, queries and locks during a selected hour, and how they changed over time.

Process CPU activity and the process snapshot for a recorded hour

Open the interactive preview.

A recorded hour, 21 September 2026, 08:59:46–09:59:46 UTC: Processes · Statements · Plans · Host · Events.

Install and run

Install Kronika 1.2.4 from a Linux release archive, or build from source.

Choose local to record Linux and, optionally, PostgreSQL in the same VM or pod. Choose postgresql for a remote server or when you only need database metrics.

Linux and optional PostgreSQL

Start collecting Linux metrics:

sudo /usr/local/bin/kronika-collector \
  --storage-dir /var/lib/kronika

For PostgreSQL on the collector machine, supply its connection string with --pg-dsn when starting collector. Use a PostgreSQL account with the monitoring privileges.

sudo /usr/local/bin/kronika-collector \
  --storage-dir /var/lib/kronika \
  --pg-dsn 'host=127.0.0.1 port=5432 user=kronika_monitor password=replace-with-password dbname=postgres sslmode=disable'

In this default local mode, the connection also discovers the current PostgreSQL log file. If that file is readable on the collector host, --pg-log is not needed.

Leave --postgres-effective-cpus and KRONIKA_POSTGRES_EFFECTIVE_CPUS unset for this local machine: CPU capacity comes from its recorded CPU snapshots.

PostgreSQL only — local or remote

sudo install -d -m 0700 -o "$(id -u)" /var/lib/kronika

/usr/local/bin/kronika-collector \
  --mode postgresql \
  --storage-dir /var/lib/kronika \
  --pg-dsn 'host=pg.example.net port=5432 user=kronika_monitor password=replace-with-password dbname=postgres'

If the PostgreSQL CPU capacity is known, add --postgres-effective-cpus 4, replacing 4 with its CPU count. Without it, SQL metrics remain available. PostgreSQL Health is unknown. See collector configuration.

To collect from several PostgreSQL servers, run a kronika-collector process for each server with its DSN and a separate storage directory. See the two-server example.

View recorded data

Run kronika-web with the collector’s data directory.

For local mode

sudo /usr/local/bin/kronika-web --storage-dir /var/lib/kronika \
  --listen 0.0.0.0:8080

For postgresql mode

/usr/local/bin/kronika-web --storage-dir /var/lib/kronika \
  --listen 0.0.0.0:8080

Open http://<server-ip>:8080.

To require sign-in, add --user kronika --password 'replace-with-a-random-password'. Options override their environment fallbacks; existing KRONIKA_WEB_* service settings continue to work. See kronika-web --help for the full option list.

Systemd setup covers running both programs as services and changing an existing service's configuration.

Storage

For a PostgreSQL workload with roughly 500 tables and 3,000 indexes, estimate about 200 MB of compressed recordings per day. Volume depends on collection intervals and the number of recorded objects and distinct queries.

The default storage limit is 2 GiB (--retention), including journals and indexes. When the limit is exceeded, the collector removes the oldest finished recordings and their indexes.

auto and auto:P instead set a used-space percentage target for the whole backing filesystem. See storage configuration for the rotation rules and automatic mode.

Recorded data and views

Domain What you can inspect Reference
Processes Command, state and process number (PID), CPU use, memory and disk reads/writes, process tree and hourly activity. Linux metrics
Host CPU, memory, time waiting for resources (PSI), network and disks, free space and device relationships, cgroup resource limits and use. Linux metrics
PostgreSQL sessions Overview, Activity, Locks, Vacuum: session states and waits, blocking chains, query/transaction durations and table cleanup progress. PostgreSQL metrics
Queries and plans Statements and Plans: calls, execution/planning time, page and temporary-file reads, write-ahead log (WAL) output, SQL and plan text. PostgreSQL metrics
PostgreSQL objects Databases, Tables and Indexes: settings, size, reads and changes, maintenance and transaction ages. Grouping by database, schema and tablespace. PostgreSQL metrics
Events Grouped PostgreSQL/PgBouncer log events, occurrences, durations and recorded context, metric marks. Views and controls
Time and charts Choose an hour and a time within it. View changes, activity maps, totals and the distribution of measurements. Time and calculations

Views and controls explains how to select measurements, group, search and sort rows, inspect details in Inspector, view charts and export. The operator guide contains four worked examples from the 5 September recording.

Recorded statement, SQL text and interval activity

Recorded execution plan and associated SQL

Collection and access

Linux and PostgreSQL feed the collector, and web reads its recording for the browser and MCP clients

The default collection intervals are 5 seconds for processes, 10 seconds for core Linux metrics, 30 seconds for PostgreSQL metrics, and 300 seconds for tables and indexes. Collector configuration defines source selection, intervals, access permissions and removal of old recordings.

The web server serves the browser, HTTP API and MCP at one address and port. The AI panel provides connection settings. MCP tools return values at a chosen time, objects ranked by a measurement, field descriptions, events and row details.

Portable HTML export

Export saves a selected interval of your recording as one interactive HTML file. It includes the interface and data, so tables, search and charts work without a server or network connection.

Export an interval from web or a saved recording into one interactive offline HTML file

kronika-dump inspects storage and extracts an interval into a standalone ZMS recording, and kronika-report converts that recording into HTML.

Documentation

MIT License.

About

The chronicle of your PostgreSQL's past

Resources

Stars

10 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages