Skip to main content

Service Metrics Data API

This topic covers how to programmatically retrieve Sonatype Nexus Repository usage metrics using the /service/metrics/data API. Note that this API is not currently available in the Swagger documentation that displays within the Sonatype Nexus Repository user interface.

Required Privileges

You will need at least the nexus:metrics:read privilege to use this API.

To programmatically retrieve Sonatype Nexus Repository usage metrics, query /service/metrics/data, and look for the fields specified in the table below.

Metric*

JSON Path

Notes

Total Components

gauges.nexus.analytics.component_total_count.value

Shows current total

Max Components (30 days)

max(gauges.nexus.analytics.component_total_count.value)

Track component_total_count over 30 days to get a peak value

Requests per Day

gauges.nexus.analytics.content_request_count.value.day

Shows current daily total

Peak Requests per Day (30 days)

max(gauges.nexus.analytics.content_request_count.value.day)

Track content_request_count over 30 days to get a peak value

* "Metric" in this instance refers to the corresponding metric available in the user interface via the Usage Center. For maximum data parity with the user interface metrics information, you will want to retrieve this data before midnight (based on server time) each day.