From 9c6a93eddc8a569240ae36cff503674fff379dad Mon Sep 17 00:00:00 2001 From: cypherpunk Date: Wed, 13 Jul 2016 14:33:55 +0200 Subject: [PATCH 1/4] refactored compose to use grafana over promdash, added node-exporter for host metrics and use upstream prometheus --- docker-compose.yml | 105 ++++++++++++++++++--------------------------- 1 file changed, 42 insertions(+), 63 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 0b2d540..af64207 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,65 +1,44 @@ -prometheus: - image: "vegasbrianc/prom" - ports: - - "9090:9090" - links: - - "exporter:export" - - "cadvisor:cadvisor" - labels: - - "name=prometheus" - - "description=Core of Promethues" - - "version=0.16.1" +version: '2' -exporter: - image: "prom/container-exporter" - volumes: - - /sys/fs/cgroup:/cgroup - - /var/run/docker.sock:/var/run/docker.sock - ports: - - "9104:9104" - expose: - - "9104" - labels: - - "name=exporter" - - "description=Exports prom data" - - "version=latest" +volumes: + prometheus_data: {} + grafana_data: {} -sqlite3: - image: "prom/promdash" - command: - - "./bin/rake db:migrate" - volumes: - - "/tmp/prom:/tmp/prom" - environment: - - "DATABASE_URL=sqlite3:/tmp/prom/file.sqlite3" - -promdash: - image: "prom/promdash" - ports: - - "3000:3000" - expose: - - "3000" - volumes: - - /tmp/prom:/tmp/prom - environment: - - "DATABASE_URL=sqlite3:/tmp/prom/file.sqlite3" - labels: - - "name=prom dashboard" - - "description=Dashboards for metrics" - - "version=latest" - -cadvisor: - image: "google/cadvisor" - volumes: - - "/:/rootfs:ro" - - "/var/run:/var/run:rw" - - "/sys:/sys:ro" - - "/var/lib/docker/:/var/lib/docker:ro" - ports: - - "8080:8080" - expose: - - "8080" - labels: - - "name=cAdvisor" - - "description=Google Container Advisor collects metrics from host and containers" - - "version=latest" +services: + prometheus: + image: prom/prometheus + volumes: + - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml + - prometheus_data:/prometheus + command: + - '-config.file=/etc/prometheus/prometheus.yml' + - '-storage.local.path=/prometheus' + expose: + - 9090 + links: + - cadvisor:cadvisor + depends_on: + - cadvisor + node-exporter: + image: prom/node-exporter + expose: + - 9100 + cadvisor: + image: google/cadvisor + volumes: + - /:/rootfs:ro + - /var/run:/var/run:rw + - /sys:/sys:ro + - /var/lib/docker/:/var/lib/docker:ro + expose: + - 8080 + grafana: + image: grafana/grafana:3.0.4 + depends_on: + - prometheus + ports: + - 3000:3000 + volumes: + - grafana_data:/var/lib/grafana + env_file: + - config.monitoring From 8acb6e3bf1591276b117d188b3c5182cd0958847 Mon Sep 17 00:00:00 2001 From: cypherpunk Date: Wed, 13 Jul 2016 14:35:35 +0200 Subject: [PATCH 2/4] updated prometheus config with node-exporter target --- prom/prometheus.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/prom/prometheus.yml b/prom/prometheus.yml index 3b587fe..f46071b 100644 --- a/prom/prometheus.yml +++ b/prom/prometheus.yml @@ -7,7 +7,7 @@ global: # Attach these labels to any time series or alerts when communicating with # external systems (federation, remote storage, Alertmanager). external_labels: - monitor: 'codelab-monitor' + monitor: 'my-project' # Load and evaluate rules in this file every 'evaluation_interval' seconds. rule_files: @@ -15,7 +15,6 @@ rule_files: # - "second.rules" # A scrape configuration containing exactly one endpoint to scrape: -# Here it's Prometheus itself. scrape_configs: # The job name is added as a label `job=` to any timeseries scraped from this config. - job_name: 'prometheus' @@ -28,4 +27,4 @@ scrape_configs: # scheme defaults to 'http'. target_groups: - - targets: ['localhost:9090','cadvisor:8080'] + - targets: ['localhost:9090','cadvisor:8080','node-exporter:9100'] From 28642518b1a05e613c6294b194a8e5d4670bb824 Mon Sep 17 00:00:00 2001 From: cypherpunk Date: Wed, 13 Jul 2016 14:37:04 +0200 Subject: [PATCH 3/4] added environment config file for the stack. only used by grafana so far --- config.monitoring | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 config.monitoring diff --git a/config.monitoring b/config.monitoring new file mode 100644 index 0000000..f12466b --- /dev/null +++ b/config.monitoring @@ -0,0 +1,2 @@ +GF_SECURITY_ADMIN_PASSWORD=foobar +GF_USERS_ALLOW_SIGN_UP=false From 560d90d537adea085e79ce0d27f0e2a654bdea6e Mon Sep 17 00:00:00 2001 From: cypherpunk Date: Wed, 13 Jul 2016 15:47:57 +0200 Subject: [PATCH 4/4] removed grafana version pinning --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index af64207..f367853 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -33,7 +33,7 @@ services: expose: - 8080 grafana: - image: grafana/grafana:3.0.4 + image: grafana/grafana depends_on: - prometheus ports: