Skip to main content

Prometheus

Nexus Repository exports its metrics in Prometheus format at /service/metrics/prometheus and requires Application privilege for Domainmetrics and action read(or use existing nx-metrics-all privilege) to access it. To consume those metrics you need to configure your Prometheus to scrape the data from Nexus Repository. For your convenience, we have provided an example Prometheus YAML file below that you can pass to Prometheus (remember to edit the target to point to your Nexus Repository instance; we used host.docker.internal:8081). Once you've got your Prometheus running, verify connectivity between Prometheus and Nexus Repository at http://your-prometheus-server/targets. You can stop here or you can go further and use Prometheus as a datasource for another tool like Grafana or Elastic.

Example Prometheus YAML

# my global config
global:
  scrape_interval: 15s # Set the scrape interval to every 15 seconds. The default is every 1 minute.
  evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).

# Alertmanager configuration
alerting:
  alertmanagers:
    - static_configs:
        - targets:
          # - alertmanager:9093

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
scrape_configs:
  - job_name: "prometheus"
    scrape_interval: 15s  
    scrape_timeout: 10s  
    metrics_path: /service/metrics/prometheus  
    scheme: http  
    basic_auth:    
      username: admin    
      password: admin
    static_configs:
      - targets: ["localhost:8081"]