Follow these steps to configure Prometheus to scrape metrics from all nodes in your MinIO cluster:
/minio/metrics/v3 endpoint on port 9000./minio/metrics/v3/api - API request metrics/minio/metrics/v3/audit - Audit functionality metrics/minio/metrics/v3/cluster - Cluster-wide metrics including config, health, IAM, and usage/minio/metrics/v3/debug - Go runtime metrics/minio/metrics/v3/ilm - ILM (Lifecycle Management) metrics/minio/metrics/v3/logger - Logger webhook metrics/minio/metrics/v3/notification - Notification functionality metrics/minio/metrics/v3/replication - Site and bucket replication metrics/minio/metrics/v3/scanner - Scanner metrics/minio/metrics/v3/system - System metrics including CPU, memory, drives, and networkMinIO v3 metrics require bearer token authentication
Generate a bearer token using the MinIO admin credentials:
# First, configure your MinIO server alias if not already done
mc alias set myminio http://your-minio-server:9000 admin your-password
# Generate the bearer token for v3 metrics
mc admin prometheus generate myminio --api-version v3
The command will output a prometheus config that looks like this:
scrape_configs:
- job_name: minio-job
bearer_token: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJwcm9tZXRoZXVzIiwic3ViIjoiYWRtaW4iLCJleHAiOjQ5MDA2ODQ0MjF9._irfBI8ODRTyhf4tWYCUEl2aAihPkSD0VCbGR12cmUhLnywkziOIP29tFQ8Zan_HCTDdnoXfhryX4a-8GXPkxQ
metrics_path: /minio/metrics/v3
scheme: http
static_configs:
- targets: ['minio-1-1:9000']
You can also verify the token works by testing the metrics endpoint:
# Test the bearer token with curl
curl -s -H "Authorization: Bearer "your-token" http://minio-node1.example.com:9000/minio/metrics/v3
# If successful, you should see MinIO metrics output
# If the token is invalid, you'll get an authentication error
prometheus.yml file (usually found in /etc/prometheus/ or your Prometheus deployment directory).scrape_configs: section, add a new job for MinIO.static_configs block to list all MinIO nodes under the targets parameter.host:port./minio/metrics/v3 endpoint.bearer_token field with your generated token.buckets query parameter.scrape_configs:
# ... other scrape configs ...
- job_name: 'minio'
metrics_path: '/minio/metrics/v3'
bearer_token: 'your-generated-bearer-token'
static_configs:
- targets:
- 'minio-node1.example.com:9000'
- 'minio-node2.example.com:9000'
- 'minio-node3.example.com:9000'
# Optional: Configure separate jobs for specific metric types
- job_name: 'minio-cluster'
metrics_path: '/minio/metrics/v3/cluster'
bearer_token: 'your-generated-bearer-token'
static_configs:
- targets:
- 'minio-node1.example.com:9000'
# Per-bucket API metrics configuration
- job_name: 'minio-bucket-api'
bearer_token: 'your-generated-bearer-token'
file_sd_configs:
- files:
- /opt/prometheus/minio_buckets.json
relabel_configs:
- source_labels: [__metrics_path__]
target_label: __metrics_path__
Create the file `/opt/prometheus/minio_buckets.json` with the following content:
```json
[
{
"targets": ["minio-node1.example.com:9000"],
"labels": {
"__metrics_path__": "/minio/metrics/v3"
}
},
{
"targets": ["minio-node1.example.com:9000"],
"labels": {
"__metrics_path__": "/minio/metrics/v3/bucket/api/warp-bucket"
}
}
]
This configuration allows you to:
prometheus.yml.http://<prometheus-server>:9090/targets) to ensure all MinIO nodes are listed and being scraped.Note:
targets list to match./minio/metrics/v3 endpoint is specific to MinIO v3. If you're using a different version, adjust the metrics path accordingly./minio/metrics/v3/cluster) can help reduce the amount of data collected and improve scraping performance if you only need certain types of metrics./minio/metrics/v3/bucket/api), you must explicitly list all buckets you want to monitor in the buckets parameter. Metrics will only be collected for the specified buckets.buckets parameter in your Prometheus configuration to include them.