30 Eylül 2022 Cuma

Docker Compose ve Grafana

Örnek
Şöyle yaparız
grafana:
    image: grafana/grafana-oss:8.5.2
    pull_policy: always
    network_mode: host
    container_name: grafana
    restart: unless-stopped
    links:
      - prometheus:prometheus
    volumes:
      - ./data/grafana:/var/lib/grafana
    environment:
      - GF_SECURITY_ADMIN_PASSWORD=admin
      - GF_SERVER_DOMAIN=localhost
Örnek
Şöyle yaparız
version: '3.8'

services:
  prometheus:
    image: prom/prometheus:latest
    container_name: prometheus
    ports:
      - 9090:9090
    volumes:
      - ./prometheus.yml:/etc/prometheus/prometheus.yml
    command:
      - --config.file=/etc/prometheus/prometheus.yml
    depends_on:
      - mysql

  grafana:
    image: grafana/grafana:latest
    container_name: grafana
    ports:
      - 3000:3000
    depends_on:
      - prometheus
    environment:
      - GF_AUTH_ANONYMOUS_ENABLED=true
      - GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
    volumes:
      - ./grafana:/var/lib/grafana

Örnek
Şöyle yaparız. Burada Grafana metadata'yı saklamak için PostgreSQL veri tabanını kullanıyor. Bağlanmak için http://<ip_of_the_host_machine>:3111 adresine gideriz.
version: '3.8'
services:
  ...
  pg_grafana:
    container_name: pg_grafana
    image: postgres:15
    restart: always
    environment:
      POSTGRES_DB: my_grafana_db
      POSTGRES_USER: my_grafana_user
      POSTGRES_PASSWORD: my_grafana_pwd
    ports:
      - "5499:5432"
    volumes:
      - pg_grafana:/var/lib/postgresql/data
  grafana:
    container_name: grafana
    image: grafana/grafana:latest
    user: "0:0"
    environment:
      GF_DATABASE_TYPE: postgres
      GF_DATABASE_HOST: pg_grafana:5432
      GF_DATABASE_NAME: my_grafana_db
      GF_DATABASE_USER: my_grafana_user
      GF_DATABASE_PASSWORD: my_grafana_pwd
      GF_DATABASE_SSL_MODE: disable
    restart: unless-stopped
    depends_on:
        - pg_grafana
    ports:
      - 3111:3000
    volumes:
      - grafana:/var/lib/grafana
volumes:
  pg_grafana:
    driver: local
  grafana:
    driver: local
grafana.ini Dosyası
Örnek
Şöyle yaparız
services:
  grafana:
    image: grafana/grafana:10.0.3
    ports:
      - 3000:3000
    volumes:
      - ./grafana/tmp:/var/lib/grafana
      - ./grafana/grafana.ini:/etc/grafana/grafana.ini
Şöyle yaparız
[paths]
data = /var/lib/grafana/data
logs = /var/log/grafana
plugins = /var/lib/grafana/plugins
[server]
http_port = 3000


Hiç yorum yok:

Yorum Gönder