From 091c3367026a2d9a6bbf2aa5686c55d02db7b4df Mon Sep 17 00:00:00 2001 From: "ru.rocker81@gmail.com" Date: Fri, 31 Mar 2017 20:46:42 +0700 Subject: [PATCH] prometheus/grafana already in docker compose --- .gitignore | 1 + docker/docker-compose-prometheus-grafana.yml | 17 ++++++++++++ lorem-rate-limit/prometheus/prometheus.yml | 28 ++++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 docker/docker-compose-prometheus-grafana.yml create mode 100644 lorem-rate-limit/prometheus/prometheus.yml diff --git a/.gitignore b/.gitignore index f0e323a..9ab5f39 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,4 @@ _testmain.go *.test *.prof /log/ +/extra/* diff --git a/docker/docker-compose-prometheus-grafana.yml b/docker/docker-compose-prometheus-grafana.yml new file mode 100644 index 0000000..9f31148 --- /dev/null +++ b/docker/docker-compose-prometheus-grafana.yml @@ -0,0 +1,17 @@ +version: '2' + +services: + prometheus: + image: prom/prometheus + ports: + - 9090:9090 + volumes: + - $PWD/lorem-rate-limit/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml + grafana: + image: grafana/grafana + ports: + - 3000:3000 + environment: + - GF_SECURITY_ADMIN_PASSWORD=password + volumes: + - $PWD/extra/grafana_db:/var/lib/grafana grafana/grafana \ No newline at end of file diff --git a/lorem-rate-limit/prometheus/prometheus.yml b/lorem-rate-limit/prometheus/prometheus.yml new file mode 100644 index 0000000..6b6e75a --- /dev/null +++ b/lorem-rate-limit/prometheus/prometheus.yml @@ -0,0 +1,28 @@ +global: + scrape_interval: 15s # By default, scrape targets every 15 seconds. + + # Attach these labels to any time series or alerts when communicating with + # external systems (federation, remote storage, Alertmanager). + external_labels: + monitor: 'rurocker-monitor' + +# 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' + + # Override the global default and scrape targets from this job every 5 seconds. + scrape_interval: 5s + + static_configs: + - targets: ['localhost:9090'] + labels: + group: 'local' + + - job_name: 'ru-rocker' + scrape_interval: 5s + static_configs: + - targets: ['192.168.1.103:8080'] + labels: + group: 'lorem' \ No newline at end of file