How to Monitor Nexus Repository with Prometheus & Grafana: Step‑by‑Step Guide
Learn how to set up Prometheus to scrape Nexus repository metrics, configure authentication, and create insightful Grafana dashboards that visualize component, Jetty, and JVM metrics, enabling proactive troubleshooting and resource optimization for Nexus services.
Introduction
Nexus is an open‑source Maven repository manager that also supports package management for Npm, .Net, Golang, Python and other languages. It stores build artifacts for multiple development teams, and any outage can block CI/CD pipelines. This guide shows how to monitor Nexus at runtime using Prometheus and Grafana.
Nexus version: 3.29.2-02
1. Collecting Metrics
Nexus exposes a Prometheus‑compatible metrics endpoint that requires the
nx-metrics-allrole. The endpoint is:
http://localhost:8081/service/metrics/prometheusCreating a metrics account
Create a dedicated user for metrics collection, assign a new role
nx-metricswith the
nx-metrics-allprivilege, and bind the role to the user.
Configure Prometheus
After the metrics user is ready, add the following job to Prometheus’ configuration:
global:
scrape_interval: 15s
scrape_timeout: 10s
evaluation_interval: 15s
alerting:
alertmanagers:
- static_configs:
- targets: []
scheme: http
timeout: 10s
scrape_configs:
- job_name: nxrm
scrape_interval: 15s
scrape_timeout: 10s
metrics_path: /service/metrics/prometheus
scheme: http
basic_auth:
username: metrics
password: metrics
static_configs:
- targets:
- localhost:8081When the configuration is correct, Prometheus will start collecting metrics prefixed with
org_sonatype_nexus_.
2. Building Grafana Dashboards
Nexus provides over 2,000 metric lines. They fall into three main categories:
Component : Runtime metrics of components such as
FileBlobStore, prefixed with
org_sonatype_nexus_.
Jetty : Web container metrics, prefixed with
org_eclipse_jetty_.
JVM : JVM runtime metrics (heap, non‑heap, GC), prefixed with
jvm_.
Component metrics are the most numerous; some are always zero and can be omitted from dashboards.
Example Panels
Component Panel (e.g., LdapServerComponent)
This panel shows runtime information for the LDAP component, helping quickly locate authentication issues.
Component Exceptions Panel
Displays any component exceptions; a metric value greater than zero indicates a problem.
Jetty WebAppContext Panel
Shows request/response traffic. Monitor
wait-jobsto detect thread‑pool saturation.
JVM Runtime Panel
Displays heap, non‑heap, off‑heap memory usage and GC activity. In the described environment, Nexus used more than the configured 2 GB Xmx due to off‑heap buffers.
Conclusion
Adding Nexus monitoring provides clear visibility into runtime health, aids rapid troubleshooting, and enables proactive alerting. The Grafana dashboards created in this guide are available on the Grafana Marketplace (ID 16459) for easy import.
Dashboard link: https://grafana.com/grafana/dashboards/16459
Open Source Linux
Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.