Skip to content

Commit

Permalink
Merge pull request #4 from seznam/dv-all-in-one-example
Browse files Browse the repository at this point in the history
doc: all-in-one example, grafana dashboards
  • Loading branch information
david-vavra authored Jul 22, 2020
2 parents b92a09f + f135c60 commit 47d65fa
Show file tree
Hide file tree
Showing 18 changed files with 2,489 additions and 16 deletions.
33 changes: 30 additions & 3 deletions examples/all_in_one/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,31 @@
# TODO
# All-in-one example
### Overview
Use the provided [docker-compose](./docker-compose.yaml) to start the complete setup with Prometheus instance loaded with [example SLO recording rules](../../prometheus_rules), and Grafana instance with loaded [SLO dashboards](../../grafana_dashboards)

Example with docker compose which runs some dummy app, slo-exporter,
Prometheus and Grafana to see the whole setup.
Description of the whole setup follows:
- **Nginx configured with the following paths:**
- `nginx:8080/` -> `HTTP 200`, all ok
- `nginx:8080/err` -> `HTTP 500`, availability violation
- `nginx:8080/drop`-> `limit 1r/m`, latency violation
- **Slo-exporter configured to tail the nginx's logs**
- **Prometheus**
- configured to scrape the slo-exporter's metrics
- loaded with necessary recording-rules for SLO computation
- **Grafana**
- with Prometheus preconfigured as a datasource
- loaded with [SLO dashboards](../../grafana_dashboards/)
- **Slo-event-generator**
- infinite loop accessing the nginx instance to generate slo-events.

### How to run it
```
docker-compose up
```

To access Grafana and Prometheus:
```
# http://localhost:9090 Prometheus
# http://localhost:9000 Grafana
# User: admin
# Password: admin
```
70 changes: 70 additions & 0 deletions examples/all_in_one/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
version: '3'

services:
nginx:
image: nginx
volumes:
- "./nginx/conf/nginx.conf:/etc/nginx/nginx.conf:ro"
- "./nginx/static:/nginx/static:ro"
- "nginx-logs:/nginx/logs/"

slo-exporter:
image: seznam/slo-exporter:6.1.0
depends_on:
- nginx
ports:
- 8001:8001
working_dir: /slo-exporter
command:
- "--config-file=/slo-exporter/conf/slo_exporter.yaml"
volumes:
- ./slo-exporter/conf:/slo-exporter/conf/
- nginx-logs:/logs/

slo-event-generator:
image: nginx
entrypoint: /bin/bash
command: -c 'while true; do
for i in `seq 20`; do curl -s http://nginx:8080/ >/dev/null 2>&1 ; done;
for i in `seq $$(($$RANDOM % 3))`; do curl -s http://nginx:8080/err >/dev/null 2>&1 ; done;
curl -m 1 -s http://nginx:8080/drop >/dev/null 2>&1 >/dev/null || true;
echo -n ".";
sleep 5;
done'

prometheus:
image: prom/prometheus:latest
depends_on:
- slo-exporter
ports:
- 9090:9090
environment:
PROMETHEUS_CONFIG: |
{
"scrape_configs":[{
"job_name": "slo-exporter",
"scrape_interval": "2s",
"static_configs":[
{"targets":["slo-exporter:8001"]},
],
}],
"rule_files": ["/prometheus/recording_rules/*yaml", "/prometheus/recording_rules/slo/*yaml"]
}
entrypoint: ["sh"]
command:
- "-c"
- 'echo $$PROMETHEUS_CONFIG > /etc/prometheus/prometheus.yml; prometheus --config.file=/etc/prometheus/prometheus.yml'
volumes:
- ./prometheus/recording_rules:/prometheus/recording_rules

grafana:
image: grafana/grafana
depends_on:
- prometheus
ports:
- 3000:3000
volumes:
- ./grafana/provisioning/:/etc/grafana/provisioning/

volumes:
nginx-logs:
Loading

0 comments on commit 47d65fa

Please sign in to comment.