-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from seznam/dv-all-in-one-example
doc: all-in-one example, grafana dashboards
- Loading branch information
Showing
18 changed files
with
2,489 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
Oops, something went wrong.