Commit af794aed authored by moritz.weichert's avatar moritz.weichert

Final techtalk stuff

parent 562221d3
# Techtalks about Prometheus Monitoring
\ No newline at end of file
# Techtalks about Prometheus Monitoring
## General
The folder demo contains all what is needed for deploying a simple prometheus stack with grafana and two demo apps.
Simply run
```bash
docker-compose up
```
inside the demo folder and the full stack will be created.
In the root directory is the sample Go Application, which was build with
``` bash
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main .
```
This command compiles a binary file called main, which is then put inside a docker container!
......@@ -8,13 +8,15 @@ services:
command: "--config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/prometheus"
ports:
- 9090:9090
goApp1:
image: example-scratch:latest
goapp1:
build: '../'
grafana:
image: grafana/grafana:5.3.2
environment:
- GF_SECURITY_ADMIN_PASSWORD=pass
ports:
- 3000:3000
goApp2:
image: example-scratch:latest
\ No newline at end of file
goapp2:
build: '../'
#exporter:
# image: prom/node-exporter:v0.16.0
\ No newline at end of file
......@@ -8,5 +8,7 @@ scrape_configs:
- job_name: goApp
static_configs:
- targets:
- goApp1:8080
- goApp2:8080
\ No newline at end of file
- goapp1:8080
- goapp2:8080
#- localhost:9090
#- exporter:9100
\ No newline at end of file
No preview for this file type
groups:
- name: techtalk
rules:
# Alert for any instance that is unreachable for >5 minutes.
- alert: InstanceDown
expr: up == 0
for: 30s
labels:
severity: page
annotations:
summary: "Instance {{ $labels.instance }} down"
description: "{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 30 seconds."
global:
slack_api_url: https://hooks.slack.com/services/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
route:
receiver: 'pushover'
receivers:
- name: 'slack'
slack_configs:
- username: 'Prometheus'
channel: '#techtalk-prom-demo'
text: "<!channel> \n {{ range .Alerts}}summary: {{ .Annotations.summary }}\n description: {{ .Annotations.description }} \n\n{{ end }}"
- name: 'pushover'
pushover_configs:
- send_resolved: true
priority: 0
token: ay4yuv58m9k9c11qvbbpqmpawfyko6
user_key: uq2igmdbjbpz5ay2n4mc1ry7djs8yz
\ No newline at end of file
version: "3"
services:
prom:
image: prom/prometheus:v2.4.3
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
- ./alert.rules.yml:/etc/prometheus/alert.rules.yml
command: "--config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/prometheus"
ports:
- 9090:9090
depends_on:
- exporter
exporter:
image: prom/node-exporter:v0.16.0
ports:
- "9100:9100"
alertmanager:
image: prom/alertmanager:v0.15.2
volumes:
- ./alertmanager.yml:/alertmanager.yml
command:
- '--config.file=/alertmanager.yml'
- '--web.external-url=http://localhost:9093/'
ports:
- '9093:9093'
\ No newline at end of file
../prometheus-only/prometheus.yml
\ No newline at end of file
alerts1='[
{
"labels": {
"alertname": "DiskRunningFull",
"dev": "sda1",
"instance": "example1"
},
"annotations": {
"info": "The disk sda1 is running full",
"summary": "please check the instance example1"
}
},
{
"labels": {
"alertname": "DiskRunningFull",
"dev": "sda2",
"instance": "example1"
},
"annotations": {
"info": "The disk sda2 is running full",
"summary": "please check the instance example1",
"runbook": "the following link http://test-url should be clickable"
}
},
{
"labels": {
"alertname": "DiskRunningFull",
"dev": "sda1",
"instance": "example2"
},
"annotations": {
"info": "The disk sda1 is running full",
"summary": "please check the instance example2"
}
},
{
"labels": {
"alertname": "DiskRunningFull",
"dev": "sdb2",
"instance": "example2"
},
"annotations": {
"info": "The disk sdb2 is running full",
"summary": "please check the instance example2"
}
},
{
"labels": {
"alertname": "DiskRunningFull",
"dev": "sda1",
"instance": "example3",
"severity": "critical"
}
},
{
"labels": {
"alertname": "DiskRunningFull",
"dev": "sda1",
"instance": "example3",
"severity": "warning"
}
}
]'
curl -XPOST -d"$alerts1" http://localhost:9093/api/v1/alerts
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment