Skip to main content

Intelligent disk diagnostics and storage observability for SREs

Project description

๐Ÿฉบ dxcli โ€” The Disk Doctor

Stop firefighting. Start predicting.
Replace your 45-minute disk investigation with a 30-second diagnosis.

PyPI version Python License: MIT


The Problem

It's 2 AM. PagerDuty fires. Your production server is at 98% disk.

You SSH in and start the ritual:

df -h          # okay, it's /var
du -sh /var/*  # narrowing down...
du -sh /var/log/* | sort -h  # getting warmer...
find /var/log -size +100M    # which file?
lsof | grep deleted          # which process?!

45 minutes later, you've found the culprit โ€” a runaway log file from a service nobody knew was deployed. You delete it, go back to sleep, and it happens again next week.

There is a better way.


The Solution

dxcli diagnose /var
๐Ÿฉบ Disk Doctor โ€” Diagnosis Report
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

๐Ÿšจ LOG BOMB DETECTED
   /var/log/payments/transaction.log โ€” 14.2 GB
   โ†ณ Written by: payments-service (PID 18423)
   โ†ณ Last rotation: Never
   โ†ณ Prescription: Add logrotate config immediately

โš ๏ธ  STALE DATA
   /var/cache/thumbnails โ€” 8.7 GB
   โ†ณ Last accessed: 94 days ago
   โ†ณ Prescription: Safe to archive or delete

๐Ÿ“ˆ GROWTH FORECAST
   At current rate, /var fills in 6 hours 12 minutes
   Growth is ACCELERATING (+340% vs last week)

30 seconds. Exact culprit. Exact prescription.


Features

๐Ÿ” dxcli diagnose โ€” Intelligent Diagnosis

Not just file sizes. It tells you why your disk is filling:

  • Log Bomb detection โ€” unrotated logs growing out of control
  • Stale file identification โ€” large files untouched for months
  • Process attribution โ€” exactly which PID is writing to a path

๐Ÿ“ˆ dxcli predict โ€” Time-to-Full Forecasting

Linear regression on historical snapshots stored locally. Tells you:

  • When your disk will be full (hours, days, weeks)
  • Whether growth is stable or accelerating
  • Which directories are the fastest-growing threats

๐Ÿ–ฅ๏ธ dxcli dash โ€” Real-time TUI Dashboard

A full terminal UI with live sparklines, anomaly alerts, and interactive process maps. No browser required.

โ”Œโ”€ Disk Overview โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ /var    [โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘] 84%  โ†‘ FAST  โ”‚
โ”‚ /home   [โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘] 34%  โ†’ STABLEโ”‚
โ”‚ /tmp    [โ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘] 12%  โ†“ SLOW  โ”‚
โ”‚                                                  โ”‚
โ”‚ ๐Ÿšจ ANOMALY: Log Bomb in /var/log/payments        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ”ญ dxcli serve โ€” The Sentinel (Prometheus-compatible)

Run as a background daemon. Exports /metrics for Grafana integration. Plug dxcli's intelligence directly into your existing observability stack.


Installation

pip install diskrx

That's it. No config files. No daemons required to get started.


Quickstart

# Diagnose a path right now
dxcli diagnose /var

# Predict when your root partition fills up
dxcli predict /

# Open the live TUI dashboard
dxcli dash

# Start the Prometheus metrics server
dxcli serve --port 8000

How It Works

dxcli stores lightweight disk snapshots in a local SQLite database (~/.dx/history.db). Over time, it builds a picture of your disk's growth patterns and uses linear regression to forecast the future.

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    dxcli Architecture                   โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  collectors/ โ”‚  analyzers/  โ”‚   store/   โ”‚  outputs/   โ”‚
โ”‚              โ”‚              โ”‚            โ”‚             โ”‚
โ”‚  Raw OS data โ”‚  The "Brain" โ”‚  SQLite DB โ”‚  Rich / TUI โ”‚
โ”‚  psutil      โ”‚  Growth rate โ”‚  Snapshots โ”‚  Prometheus โ”‚
โ”‚  File scans  โ”‚  Anomaly     โ”‚  History   โ”‚  HTTP API   โ”‚
โ”‚  PID mapping โ”‚  detection   โ”‚            โ”‚             โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Who This Is For

  • SREs who are tired of getting paged for disk full alerts they could have predicted
  • DevOps engineers who want disk intelligence in their Grafana dashboards
  • Platform engineers who need to attribute storage costs to specific services
  • Anyone who has typed du -sh * | sort -h more than once this month

Integrations

Grafana / Prometheus

Add to your prometheus.yml:

scrape_configs:
  - job_name: 'diskrx'
    static_configs:
      - targets: ['localhost:8000']

Have a feature request? Open an issue.


Contributing

Contributions are welcome. Please read the contributing guide before submitting a PR.

git clone https://github.com/Seshadri724/diskrx
cd dxcli
python -m venv venv && source venv/bin/activate
pip install -e ".[test]"
pytest tests/ -v

License

MIT โ€” see LICENSE for details.


Built for SREs, by someone who got paged one too many times at 2 AM.

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

diskrx-0.1.1.tar.gz (26.2 kB view details)

Uploaded Source

Built Distribution

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

diskrx-0.1.1-py3-none-any.whl (29.8 kB view details)

Uploaded Python 3

File details

Details for the file diskrx-0.1.1.tar.gz.

File metadata

  • Download URL: diskrx-0.1.1.tar.gz
  • Upload date:
  • Size: 26.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for diskrx-0.1.1.tar.gz
Algorithm Hash digest
SHA256 06aae1b408feaaaf41cf8613d58d6e906f62712023ba086e107f7659396719de
MD5 aa171a85cb781cc89ae9b24dd98bc09b
BLAKE2b-256 7a32fcc3d1714d9fb8e2fb908e363388d87ac659dbfc46fcaff2e6412edad640

See more details on using hashes here.

File details

Details for the file diskrx-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: diskrx-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 29.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for diskrx-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 64b881bab2c34fc77e864e11d22268237f651f750853d72d6d1a605487a5f5b1
MD5 f807fd37eab2bc6103a45c747dbb13ee
BLAKE2b-256 f65959c4e510712f00d4ff65256e7491d5123876203c66ce23399c64b314cfb2

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