Skip to content

Prometheus

yusing edited this page Feb 1, 2025 · 3 revisions

Prometheus

Prerequisites

To enable prometheus monitoring, set GODOXY_PROMETHEUS_ENABLED to true in .env

Example

  1. Prepare data directory

    mkdir -p prom/data

  2. Create prometheus config

    nano prom/config.yml

    scrape_configs:
      - job_name: GoDoxy
        metrics_path: /v1/metrics
        scrape_interval: 5s
        scrape_timeout: 3s
        static_configs:
          - targets
            - 127.0.0.1:8888 # port should match `GODOXY_API_ADDR`
  3. Create Docker compose

    nano ./compose.yml

    services:
    grafana:
      image: grafana/grafana-oss
      container_name: grafana
      user: 1001:1001
      restart: unless-stopped
      volumes:
        - ./grafana:/var/lib/grafana
    prometheus:
      image: prom/prometheus
      container_name: prometheus
      user: 1001:1001
      network_mode: host
      restart: unless-stopped
      command:
        - --web.listen-address=127.0.0.1:8889
        - --web.enable-admin-api
        - --config.file=/etc/prometheus/prometheus.yml
      volumes:
        - ./prom/config.yml:/etc/prometheus/prometheus.yml:ro
        - ./prom/data:/prometheus
  4. Set permissions

    sudo chown -R 1001:1001 prom

  5. Run it

    docker compose up -d

  6. Import grafana template, see grafana_template.json

Clone this wiki locally