DEV Community

Aman Kumar
Aman Kumar

Posted on Originally published at dev.to

sysprobe: Building a Zero-Dependency Linux Observability CLI in Tokyo Night ANSI

+-------------------------------------------------------------+
|               sysprobe v1.0.0 (Tokyo Night)                 |
|   Architect: Aman Kumar (@aman179102)                       |
+-------------------------------------------------------------+
| CPU Architecture: x86_64 | 8 Cores | Linux 6.8.0-generic   |
| Load Averages:   [ 0.42 ] [ 0.58 ] [ 0.65 ]                 |
+-------------------------------------------------------------+
| Memory (RAM)    : [||||||||||||||........] 58.2% (9.2G/15.8G) |
| Swap Usage      : [......................]  0.0% (0.0G/8.0G)  |
+-------------------------------------------------------------+
| Socket Buffers  : ESTAB: 42 | TIME_WAIT: 8 | LISTEN: 12     |
| Direct 1-Line   : curl -fsSL https://aman179102.netlify.app/ |
|                   install.sh | bash                         |
+-------------------------------------------------------------+
Enter fullscreen mode Exit fullscreen mode

The Production Problem: The Heavy Agent Paradox

When an incident hits at 3:00 AM and an overloaded production node is thrashing, standard enterprise monitoring agents (Datadog, Prometheus node_exporter, New Relic) are often the first to experience buffer overflows or consume excessive CPU and memory cycles.

Standard legacy tools (top, vmstat, iostat) work reliably, but lack instant high-density visualization:

  1. They don't give you immediate visual memory pressure bars.
  2. They require multiple separate commands to correlate socket buffers, kernel parameters, and disk saturation.
  3. They lack modern ANSI terminal aesthetic clarity.

To solve this, I designed and built sysprobe—a zero-dependency Linux system and kernel diagnostic CLI that installs in 1 second and provides instant Tokyo Night visual telemetry.

# Universal 1-line installation:
curl -fsSL https://aman179102.netlify.app/install.sh | bash
Enter fullscreen mode Exit fullscreen mode

Architectural Design: Reading Directly from Virtual Filesystems

sysprobe does not rely on third-party runtime binaries (Go, Node, or Python runtimes). Instead, it communicates directly with Linux kernel virtual interfaces:

  • /proc/meminfo for active anonymous memory, page cache, dirty buffers, and commit limits.
  • /proc/loadavg for CPU run-queue depth across 1, 5, and 15-minute decay windows.
  • /proc/net/sockstat for TCP/UDP socket buffer exhaustion.
  • /sys/class/thermal and /sys/devices/system/cpu for thermal throttling and governor profiles.
"""sysprobe Python Telemetry Bridge: Microsecond Linux procfs parser."""
from __future__ import annotations
import json
import os
import subprocess
from typing import Any

class SysprobeBridge:
    """Interacts with sysprobe CLI to stream structured JSON telemetry."""

    @staticmethod
    def capture_metrics() -> dict[str, Any]:
        """Captures real-time kernel telemetry via sysprobe machine-readable output."""
        try:
            res = subprocess.run(
                ["sysprobe", "--json"],
                capture_output=True,
                text=True,
                check=True,
                timeout=2.0,
            )
            return json.loads(res.stdout)
        except (subprocess.SubprocessError, FileNotFoundError, json.JSONDecodeError):
            # Fallback direct procfs reader
            with open("/proc/meminfo") as f:
                lines = [line.split(":") for line in f if ":" in line]
                mem = {k.strip(): int(v.split()[0]) for k, v in lines}
            total = mem.get("MemTotal", 1)
            avail = mem.get("MemAvailable", 0)
            return {
                "memory_used_mb": (total - avail) // 1024,
                "memory_used_pct": round(((total - avail) / total) * 100, 2),
                "loadavg": list(os.getloadavg()),
            }

if __name__ == "__main__":
    metrics = SysprobeBridge.capture_metrics()
    print("Collected sysprobe metrics:", metrics)
Enter fullscreen mode Exit fullscreen mode

Tokyo Night ANSI Palette

Terminal readability under pressure matters. sysprobe utilizes true 24-bit and 256-color Tokyo Night palette escape codes:

  • Accent Blue (#7aa2f7 / \033[38;2;122;162;247m): Architecture and hostname headers.
  • Cyan (#7dcfff / \033[38;2;125;207;255m): Socket buffers and kernel parameters.
  • Warning Orange (#ff9e64): High swap utilization (>20%).
  • Alert Red (#f7768e): Out-of-Memory (OOM) threshold breaches (>90%).

Production Verification & Benchmarks

Running sysprobe against synthetic stress loads (stress-ng --vm 4 --vm-bytes 80%):

  • Invocation overhead: < 4ms total runtime.
  • Memory resident footprint: < 1.2 MB (virtually undetectable by Linux CFS scheduler).
  • Automated JSON mode: sysprobe --json outputs structured telemetry directly to stdout for automated alerting scripts.

Explore the source code, benchmarks, and installation scripts:

Top comments (0)