Skip to Content

Killing Heavy Monitoring for a 19MB Dual-Mode Fleet NOC

Retiring an exposed monitor and a 57% CPU collector to reclaim 1.8 GiB RAM and build a dual-mode FastAPI NOC.

Table of contents

No titles in the blog post

5 min read 19 views
Ask AI ↗
Ready to read aloud (zero-cost browser voice)
QUICK REACTION
📚 SERIES · PART 5 OF 5 Sovereign Infrastructure & Operations
Zero-dollar DR, secret hygiene, WHM exits, patch automation, dual-mode NOCs, and native Odoo addons
  1. Zero-Dollar Sovereign 3-2-1-1-0 Disaster Recovery
  2. Zero-Knowledge Secret Guard for Multi-Repo Git Fleets
  3. Exiting Legacy cPanel/WHM: Migrating 28 Client Accounts
  4. Sovereign Patch Watchdog: Auditing 9 Hosts and 129 Sites
  5. Killing Heavy Monitoring for a 19MB Dual-Mode Fleet NOC (Reading now)
📌 TL;DR EXECUTIVE BRIEF

Retired an unauthenticated Netdata agent, a 57.5% CPU cAdvisor hog, Prometheus, and Grafana to reclaim 1.80 GiB RAM and upgrade a 19 MB FastAPI dashboard into a dual-mode Guest/Admin NOC.

I opened one of my own monitoring dashboards last week and caught myself staring at forty flickering sparklines I had not touched in six months. Worse, when I inspected the containers backing that monitoring stack, I discovered two immediate problems: a privileged Netdata instance answering HTTP 200 without authentication on the public internet, and a cAdvisor collector chewing through 57.5% of a CPU core and 1.11 GiB of RAM just to feed Grafana graphs nobody opened. I shut the whole five-container stack down, reclaimed 1.80 GiB of memory, and upgraded my native 19 MB FastAPI dashboard into a dual-mode operations console.

In infrastructure engineering, it is dangerously easy to accumulate observability debt. You spin up Prometheus, Grafana, Node Exporter, cAdvisor, and Netdata early on because every homelab and cloud architecture blog tells you to. Two years later, those five containers consume more memory than your actual production databases, carry elevated Linux capabilities like SYS_ADMIN and SYS_PTRACE, and still fail to answer the only three questions you care about at 7:00 AM: are all hosts patched, are backups verified, and are all websites returning HTTP 200?

The Security Audit Wake-Up Call: An unauthenticated monitoring agent running with SYS_ADMIN, SYS_PTRACE, and unconfined AppArmor exposes live process trees, kernel versions, mount points, and container arguments to anyone who discovers the subdomain. Retiring unused dashboards shrinks both RAM overhead and attack surface simultaneously.

Auditing the Real Cost of Five-Container Observability

Before removing anything, I measured live CPU, RAM, and operational value across every monitoring container running on my utilities node. The numbers made the decision obvious within five minutes:

Component Measured Footprint Actual Usage & Risk Action Taken
Netdata Agent ~340 MiB RAM + privileged caps Answered HTTP 200 publicly with zero auth; only watched one VM. Stopped non-destructively (--restart=no), proxy route removed
cAdvisor 1.11 GiB RAM + 57.5% CPU nonstop Constant cgroup polling burning CPU cycles for unread charts. Stopped non-destructively, volume preserved
Prometheus + Grafana + Node Exporter ~350 MiB RAM combined Redundant time-series storage duplicating watchdog and Uptime Kuma checks. Stopped non-destructively, freed 1.80 GiB total RAM (7.8 GiB free)
Native Sovereign Cloud Pulse 19 MiB RSS RAM (<1% CPU) Live SSE telemetry, 9-host matrix, DR verification, 129-site search. Upgraded to Dual-Mode Guest Showcase + Private Admin NOC

Notice that I retired the legacy containers non-destructively with docker update --restart=no and stopped them cleanly while preserving their data volumes. If I ever want an historical Prometheus scrape for a deep performance benchmark, I can start it on localhost for an hour and stop it again, without leaving privileged collectors running 24/7 on public routes.

Observability should never weigh more than the workloads it observes. Nineteen megabytes of purposeful FastAPI telemetry beats two gigabytes of unread dashboards every single time.

Designing Dual-Mode Role Projection: Public Showcase vs. Private NOC

The real design challenge was balancing transparency with strict operational security. I love letting prospective clients and engineering leaders visit Sovereign Cloud Pulse to see live container availability, zero-CVE patch posture, and real-time FinOps savings. At the same time, an anonymous guest should never see internal RFC-1918 LAN addresses, specific container names, kernel build strings, off-site cloud backup URLs, or a list of hosted client domains.

To solve this cleanly inside a single 19 MB Python service, I built server-side Dual-Mode Role Projection rather than hiding DOM elements with CSS:

MODE 01 • PUBLIC GUEST
Zero-Leak Live Showcase

Streams aggregate fleet uptime, total protected workloads, zero-CVE badge, and FinOps savings over SSE. Every internal IP, hostname, container name, and client domain is stripped before JSON serialization.

MODE 02 • HMAC AUTH
24-Hour Signed Cookie Gate

Authenticating via the Admin NOC modal issues a rate-limited, HMAC-SHA256 signed HttpOnly; Secure; SameSite=Lax cookie backed by constant-time comparison and zero database dependencies.

MODE 03 • PRIVATE NOC
Full Fleet Command Matrix

Unlocks the 9-host kernel/disk/snapshot matrix, live encrypted DR backup and restore-drill verification status, a searchable 129-site TLS explorer, and a one-click fleet watchdog trigger.

Enforcing Zero-Leak Serialization in Python

Hiding sensitive panels with frontend JavaScript is security theater because any visitor can open DevTools and read the raw JSON payload. Instead, every HTTP route and Server-Sent Events stream passes through a strict projection function that checks the verified HMAC cookie first and constructs two completely separate payload shapes:

def project_telemetry(raw_snapshot: dict, is_admin: bool) -> dict:
    if is_admin:
        return {**raw_snapshot, "role": "admin"}

    # Public guest mode: aggregate operational health only, zero topology leaks
    return {
        "role": "guest",
        "fleet_hosts_healthy": raw_snapshot["summary"]["hosts_healthy"],
        "fleet_hosts_total": raw_snapshot["summary"]["hosts_total"],
        "pending_security_cves": raw_snapshot["summary"]["total_cves"],
        "sites_monitored": raw_snapshot["summary"]["sites_total"],
        "sites_up": raw_snapshot["summary"]["sites_healthy"],
        "dr_last_drill_passed": raw_snapshot["dr"]["restore_drill_ok"],
        "finops_monthly_saved_usd": raw_snapshot["finops"]["monthly_saved"],
    }

Immediately after deploying the upgraded service, I ran automated curl assertions against both the guest JSON endpoint and the live SSE stream, verifying that zero private IP prefixes, zero internal hostnames, zero backup folder URLs, and zero client domains appeared anywhere in unauthenticated responses. Only after submitting a valid admin login does the browser receive the full 9-host matrix and the one-click POST /api/admin/run-watchdog trigger.

The Permanent Ultra-Lean Observability Trio

Replacing five sprawling monitoring containers with three focused open-source pillars simplified daily operations dramatically:

  • Real-Time Pulse & Private NOC: My 19 MB FastAPI console handles live host health, backup drill verification, and instant site/TLS lookups behind dual-mode auth.
  • Public & Internal Uptime History: Self-hosted Uptime Kuma v2 tracks 24/7 HTTP latency and certificate expiration across 102 automatically synced monitors.
  • Actionable Patch & Security Work: Odoo's native project board tracks every pending patch or certificate warning until verified closed.

You can explore the rest of this lean infrastructure stack on my open-source showcase, read more deep dives across my engineering blog, or reach out if your cloud footprint is drowning in monitoring agents that cost more than the servers they watch.

WAS THIS ARTICLE HELPFUL?
0% helpful
QUICK REACTION
SHARE THIS ARTICLE
🧠 Ask AI ↗
Share ↗
EXECUTIVE ARCHITECTURE & ADVISORY View Interactive Resume (Ramon Rios Jr.) ↗
Hiring for a Senior / Principal Architect or Technical Leader?

Paste your Job Description to generate a tailored 2-page ATS resume, honest role alignment brief, and matched case studies in seconds.

Need Hands-On Architecture, Cloud, or AI Systems Delivery?

Book a focused architecture & strategy session covering migrations, infrastructure consolidation, or guardrailed AI pipelines.

Archive

Comments

Sign in to leave a comment
Zero-Knowledge Secret Guard for Multi-Repo Git Fleets
Blocking leaked passphrases with a 150-line SHA-256 pre-commit hook without storing plaintext rules.