mc admin prometheus generate
Generates a metrics scraping configuration file for use with Prometheus.
The bearer token in the generated configuration is signed locally using the credentials of the specified alias.
AIStor Server uses that access key as the identity for the scrape request and requires it to have the admin:Prometheus action.
For least-privilege scraping, point this command at an alias configured with a dedicated access key whose inline policy grants only admin:Prometheus.
See Create a dedicated access key for Prometheus.
Syntax
Parameters
ALIAS
Required
The alias of a configured MinIO AIStor deployment for which the command generates a Prometheus-compatible configuration file.
--api-version
Optional
To generate a scrape configuration for v3 metrics, include an --api-version v3 parameter.
v3 is the only accepted value.
Omit --api-version to generate a v2 metrics configuration.
--bucket
Optional
Only valid for v3 metrics.
For v3 metric types that return bucket-level metrics, specify a bucket name.
Requires --api-version.
--bucket works for the following v3 metric types:
apibatchreplication
The following example generates a configuration for API metrics from the bucket mybucket:
mc admin prometheus generate ALIAS api --bucket mybucket --api-version v3
TYPE
Optional
The type of metrics to scrape.
Valid values for metrics version 3 are:
apiauditbatchclusterdebugilmloggernotificationreplicationscannersystem
If not specified, a v3 command generates a scrape configuration for all metrics except individual bucket metrics.
For v3 bucket metrics, see --bucket.
Valid values for metrics version 2 are:
bucketclusternoderesource
If not specified, a v2 command returns cluster metrics.
Cluster metrics include selected high level node and bucket replication metrics.
Global Flags
This command supports any of the global flags.
Examples
Generate a default metrics v3 config
Use mc admin prometheus generate --api-version v3 to generate a scrape configuration that collects all v3 metrics for an MinIO AIStor deployment:
mc admin prometheus generate ALIAS --api-version v3
- Replace
ALIASwith thealiasof the MinIO AIStor deployment.
The output resembles the following:
scrape_configs:
- job_name: aistor-job
bearer_token: [auth token]
metrics_path: /minio/metrics/v3
scheme: http
static_configs:
- targets: ['localhost:9000']
Generate a v3 metrics config for another type
To generate a configuration for another metric type, specify the type. The following generates a scrape configuration for v3 cluster metrics:
mc admin prometheus generate ALIAS cluster --api-version v3
- Replace
ALIASwith thealiasof the MinIO AIStor deployment.
The output resembles the following:
scrape_configs:
- job_name: aistor-job-cluster
bearer_token: [auth token]
metrics_path: /minio/metrics/v3/cluster
scheme: http
static_configs:
- targets: ['localhost:9000']
To generate a configuration for a different metric type, replace cluster with the desired type.
Generate a v3 API, batch, or bucket replication metrics config
The following example generates a scrape configuration for v3 replication metrics of bucket mybucket:
mc admin prometheus generate ALIAS replication --bucket mybucket --api-version v3
- Replace
ALIASwith thealiasof the MinIO AIStor deployment.
The output resembles the following:
scrape_configs:
- job_name: aistor-job-replication
bearer_token: [auth token]
metrics_path: /minio/metrics/v3/bucket/replication/mybucket
scheme: https
static_configs:
- targets: [`localhost:9000`]
To scrape API or batch metrics for the bucket, replace replication with the desired type.
Generate a v3 config for bucket API metrics
The following example generates a scrape configuration for v3 API metrics for bucket mybucket:
mc admin prometheus generate ALIAS api --bucket mybucket --api-version v3
- Replace
ALIASwith thealiasof the MinIO AIStor deployment.
The output resembles the following:
scrape_configs:
- job_name: aistor-job-api
bearer_token: [auth token]
metrics_path: /minio/metrics/v3/bucket/api/mybucket
scheme: https
static_configs:
- targets: [`localhost:9000`]
Generate a default metrics v2 config
By default, mc admin prometheus generate generates a scrape configuration for v2 cluster metrics:
mc admin prometheus generate ALIAS
- Replace
ALIASwith thealiasof the MinIO AIStor deployment.
The output resembles the following:
scrape_configs:
- job_name: aistor-job
bearer_token: [auth token]
metrics_path: /minio/v2/metrics
scheme: http
static_configs:
- targets: ['localhost:9000']
Generate a v2 config for other metric types
To generate a configuration for another metric type, specify the type. The following generates a scrape configuration for v2 bucket metrics:
mc admin prometheus generate ALIAS bucket