Script icon
Docker icon
If icon
SlackIncomingWebhook icon
Log icon
Return icon
Schedule icon

Nexus Repository Blobstore Storage Space Exhaustion Sentinel

Audits Sonatype Nexus Prometheus metrics to detect blobstore disk exhaustion, available capacity drops, and read-only mode.

Categories
CoreInfrastructure

Automates continuous health and storage capacity surveillance for Sonatype Nexus Repository Manager blobstore deployments.

How it works

  1. A schedule trigger executes the Nexus storage audit workflow every 30 minutes.
  2. The Python task queries the Nexus Repository Manager Prometheus metrics endpoint on port 8081.
  3. The script extracts total and free storage bytes across active blobstores, total blob counts, and read-only status flags.
  4. An evaluation gate determines whether disk space utilization, free gigabytes, or read-only states breach operational tolerance bounds.
  5. When thresholds are breached, a high-priority Slack alert is dispatched to release engineering and artifact SREs.
  6. When artifact blobstores maintain adequate storage headroom, nominal telemetry is logged.
  7. A structured JSON audit manifest is emitted for artifact repository governance and storage capacity compliance records.

Architecture diagram

graph TD
    Trigger[Schedule Trigger: 30m] --> ScanMetrics[Python Script: Scrape Nexus Metrics]
    ScanMetrics --> EvalBreach{Disk Util > 85% OR Free Space < 50GB?}
    EvalBreach -- Yes --> SlackAlert[Slack: High-Urgency Release Alert]
    EvalBreach -- No --> LogNominal[Log: Nominal Nexus State]
    SlackAlert --> EmitManifest[Debug Return: Nexus Audit Manifest]
    LogNominal --> EmitManifest

Architecture components

  • Trigger: Automated schedule polling at 30-minute intervals.
  • Script Task: Scrapes Nexus Prometheus telemetry endpoints using Docker container isolation.
  • Decision Gate: Evaluates whether blobstore disk space utilization or read-only mode exceeds safety limits.
  • Notification Task: Dispatches structured Slack alerts with repository identity and capacity counts.
  • Audit Manifest: Emits JSON execution payloads containing artifact repository health and timestamps.

Key capabilities

  • Continuous surveillance of Sonatype Nexus blobstore disk space utilization and volume headroom.
  • Immediate detection of automatic read-only mode transitions caused by physical volume capacity limits.
  • Granular tracking of stored blob counts across Maven, npm, PyPI, and Docker registry formats.
  • Zero external dependency execution via isolated containerized Python runners.

What you get

  • Preemptive alerting on artifact storage exhaustion before developer builds and CI/CD pushes are rejected.
  • Automated tracking of volume growth trends across multi-format enterprise artifact blobstores.
  • Real-time audit manifests capturing repository storage health for SOC 2 delivery compliance.
  • Configurable tolerance thresholds adaptable to large-scale enterprise binary repositories.

Who it's for

  • Release Engineers maintaining centralized binary artifact repositories for enterprise software builds.
  • Site Reliability Engineers safeguarding CI/CD artifact publishing against silent storage fill-ups.
  • Platform Engineering teams operating shared Nexus, Artifactory, or Harbor registry infrastructure.
  • Cloud Infrastructure Architects planning persistent volume sizing and storage tiering migrations.

Why orchestrate this with Kestra

  • Deterministic Scheduling: Guarantees regular artifact storage health audits without fragile local crontab scripts.
  • Containerized Runners: Runs Python tasks inside isolated Docker containers without host library dependencies.
  • Condition Branching: Flowable If tasks route alerts and nominal logging cleanly without spaghetti code.
  • Enterprise Secret Safety: Securely injects Slack webhook credentials without plain-text exposure.

Use cases

  • Artifact Volume Full Alerting: Alerts release engineers when Docker image pushes threaten to consume remaining disk.
  • Automatic Read-Only Prevention: Catches low-disk conditions before Nexus automatically locks repositories into read-only mode.
  • Snapshot Storage Growth Auditing: Monitors rapid bloat from automated nightly build snapshots and unpruned components.
  • Continuous Storage SLA Auditing: Emits periodic manifests proving persistent storage headroom across active blobstores.

Inputs

Name Type Default Description
nexus_metrics_url STRING http://nexus.artifact-registry.svc.cluster.local:8081 Base HTTP URL exposing Nexus metrics.
target_repository STRING production-blobstore Target Nexus repository instance or blobstore identifier.
max_disk_utilization_percent FLOAT 85.0 Maximum allowable disk space utilization percentage.
min_free_space_gigabytes INT 50 Minimum acceptable free storage capacity in gigabytes remaining.
alert_on_readonly_mode BOOL true Whether automatic transition to read-only status triggers an alert.

Expected outputs

  • {{ outputs.scan_nexus_storage_telemetry.vars.total_space_gb }}: Total configured blobstore capacity in gigabytes.
  • {{ outputs.scan_nexus_storage_telemetry.vars.free_space_gb }}: Remaining available storage capacity in gigabytes.
  • {{ outputs.scan_nexus_storage_telemetry.vars.utilization_percent }}: Percentage of blobstore storage capacity utilized.
  • {{ outputs.scan_nexus_storage_telemetry.vars.is_readonly_flag }}: Flag indicating whether Nexus is in read-only mode.
  • {{ outputs.scan_nexus_storage_telemetry.vars.is_alerting }}: Boolean flag indicating capacity threshold violation.
  • {{ outputs.emit_audit_manifest.value }}: Structured JSON audit manifest emitted for compliance archives.

Prerequisites

  • Sonatype Nexus Repository Manager deployed with Prometheus metrics enabled on port 8081.
  • Metrics port reachable from the Kestra worker execution environment.
  • Docker daemon running on the Kestra host to execute containerized Python tasks.

Secrets

  • SLACK_WEBHOOK_URL: Incoming webhook URL for the target Release Engineering Slack alerting channel.

Quick start

  1. Ensure Nexus service exposes /service/metrics/prometheus on port 8081.
  2. Configure the SLACK_WEBHOOK_URL secret in your Kestra namespace settings.
  3. Specify your repository identifier in target_repository.
  4. Execute a manual test run via the Kestra UI to verify metric ingestion.
  5. Enable the periodic_nexus_audit trigger to establish automated continuous surveillance.

Common pitfalls and troubleshooting

  • Authentication Token: If Prometheus endpoint requires administrative privileges, configure basic auth headers.
  • Volume Quotas: Ensure underlying Kubernetes PVC storage class permits volume expansion without node downtime.
  • Read-Only Mode Recovery: Nexus requires explicit administrative API calls to restore read-write status after freeing space.
  • Compact Blobstore Tasks: Disk space is not reclaimed until scheduled blobstore compact tasks complete execution.

How to extend

  • Automated Cleanup Task Trigger: Trigger a Nexus scheduled task via REST API to purge unused snapshot components.
  • Dynamic Volume Expansion: Chain a Kubernetes storage task to increase PVC capacity when utilization exceeds 85%.
  • PagerDuty Escalation: Escalate to on-call release engineers if available disk drops below 20 GB.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.