diff --git a/docker/docker-compose.monitoring.yml b/docker/docker-compose.monitoring.yml new file mode 100644 index 0000000..8c0b07a --- /dev/null +++ b/docker/docker-compose.monitoring.yml @@ -0,0 +1,60 @@ +version: "3.8" + +services: + prometheus: + image: prom/prometheus:v2.51.0 + container_name: nexus-prometheus + restart: unless-stopped + ports: + - "9090:9090" + volumes: + - ./prometheus:/etc/prometheus + - prometheus-data:/prometheus + command: + - '--config.file=/etc/prometheus/prometheus.yml' + - '--storage.tsdb.path=/prometheus' + - '--web.console.libraries=/usr/share/prometheus/console_libraries' + - '--web.console.templates=/usr/share/prometheus/consoles' + - '--web.enable-lifecycle' + + grafana: + image: grafana/grafana:10.4.1 + container_name: nexus-grafana + restart: unless-stopped + ports: + - "3001:3000" + volumes: + - grafana-data:/var/lib/grafana + - ./grafana/provisioning:/etc/grafana/provisioning + environment: + - GF_SECURITY_ADMIN_USER=admin + - GF_SECURITY_ADMIN_PASSWORD=nexus2026 + - GF_USERS_ALLOW_SIGN_UP=false + + node-exporter: + image: prom/node-exporter:v1.7.0 + container_name: nexus-node-exporter + restart: unless-stopped + network_mode: host + + postgres-exporter: + image: prometheuscommunity/postgres-exporter:v0.15.0 + container_name: nexus-postgres-exporter + restart: unless-stopped + environment: + DATA_SOURCE_NAME: "postgresql://postgres@172.17.0.1:5432/nexus_autoparts?sslmode=disable" + ports: + - "9187:9187" + + redis-exporter: + image: oliver006/redis_exporter:v1.58.0 + container_name: nexus-redis-exporter + restart: unless-stopped + environment: + REDIS_ADDR: "redis://172.17.0.1:6379" + ports: + - "9121:9121" + +volumes: + prometheus-data: + grafana-data: diff --git a/docker/grafana/provisioning/datasources/prometheus.yml b/docker/grafana/provisioning/datasources/prometheus.yml new file mode 100644 index 0000000..bb009bb --- /dev/null +++ b/docker/grafana/provisioning/datasources/prometheus.yml @@ -0,0 +1,9 @@ +apiVersion: 1 + +datasources: + - name: Prometheus + type: prometheus + access: proxy + url: http://prometheus:9090 + isDefault: true + editable: false diff --git a/docker/prometheus/prometheus.yml b/docker/prometheus/prometheus.yml new file mode 100644 index 0000000..2dbacc6 --- /dev/null +++ b/docker/prometheus/prometheus.yml @@ -0,0 +1,30 @@ +global: + scrape_interval: 15s + evaluation_interval: 15s + +scrape_configs: + - job_name: 'prometheus' + static_configs: + - targets: ['localhost:9090'] + + - job_name: 'node' + static_configs: + - targets: ['node-exporter:9100'] + + - job_name: 'postgres' + static_configs: + - targets: ['postgres-exporter:9187'] + + - job_name: 'redis' + static_configs: + - targets: ['redis-exporter:9121'] + + - job_name: 'nexus-pos' + static_configs: + - targets: ['host.docker.internal:5001'] + metrics_path: /metrics + + - job_name: 'nexus-quart' + static_configs: + - targets: ['host.docker.internal:5002'] + metrics_path: /metrics