How to configure Prometheus with MinIO in BareMetal - cniackz/public GitHub Wiki

Objective:

To document how Prometheus is configured with MinIO in BareMetal

Links:

Steps:

1. Have MinIO Running and Pointing to Prometheus:

clearMinIO
export MINIO_PROMETHEUS_URL="http://localhost:9091"
export MINIO_ROOT_USER=minio
export MINIO_ROOT_PASSWORD=minio123
minio server /Volumes/data{1...4} --address :9000 --console-address :9001

2. Generate the Scrape Configuration

mc alias set myminio http://localhost:9000 minio minio123
mc admin prometheus generate myminio

Expected:

$ mc alias set myminio http://localhost:9000 minio minio123
Added `myminio` successfully.
$ mc admin prometheus generate myminio
scrape_configs:
- job_name: minio-job
  bearer_token: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJwcm9tZXRoZXVzIiwic3ViIjoibWluaW8iLCJleHAiOjQ4MzQ0MDI5OTh9.9PjQbw8FFEjAIUq-yQhpcVrMAYXa-hMX6vw41EooT7ibD--DCBzFarwSSn_mx0eADKpOt5bk0xPZ2tKsvgqffg
  metrics_path: /minio/v2/metrics/cluster
  scheme: http
  static_configs:
  - targets: ['localhost:9000']

3. Configure Prometheus:

File Example: /Users/cniackz/prometheus-2.36.0.darwin-amd64/prometheus.yml

# my global config
global:
  scrape_interval: 15s # Set the scrape interval to every 15 seconds. 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:
  # - "first_rules.yml"
  # - "second_rules.yml"

scrape_configs:
- job_name: minio-job
  bearer_token: eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJwcm9tZXRoZXVzIiwic3ViIjoibWluaW8iLCJleHAiOjQ4MzQ0MDI5OTh9.9PjQbw8FFEjAIUq-yQhpcVrMAYXa-hMX6vw41EooT7ibD--DCBzFarwSSn_mx0eADKpOt5bk0xPZ2tKsvgqffg
  metrics_path: /minio/v2/metrics/cluster
  scheme: http
  static_configs:
  - targets: ['localhost:9000']

4. Start Prometheus with Above configuration:

cd ~/prometheus-2.36.0.darwin-amd64 
./prometheus --config.file=prometheus.yml --web.listen-address 127.0.0.1:9091

5. To verify Prometheus is reachable, look into Console:

6. Prometheus has its own page:

minio_node_disk_total{instance="localhost:9000", job="minio-job", server="127.0.0.1:9000"} => 4