Skip to content
Open
27 changes: 9 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,15 @@
# grafana-docker-stack

Тут надо со своего копировать
For deploying Grafana, Prometheus and Node Exporter, make these steps:
1. Deploy stack
1. Clone repo
```
git clone https://github.com/digitalstudium/grafana-docker-stack.git
docker stack deploy -c grafana-docker-stack/docker-compose.yml monitoring
```
2. Add prometheus datasource with address `http://prometheus:9090` to grafana
3. Add these three lines to the bottom of `/var/lib/docker/volumes/monitoring_prom-configs/_data/prometheus.yml` file, to `scrape_configs:` section:
```
- job_name: 'node-exporter'

static_configs:
- targets: ['node-exporter:9100']
```
4. Reload prometheus config via this command:
```
docker ps | grep prometheus | awk '{print $1}' | xargs docker kill -s SIGHUP
2. Change configs if necessary (at least `configs/alertmanager.yml` to configure notification receivers)
3. Deploy stack
```bash
docker stack deploy -c grafana-docker-stack/docker-compose.yml monitoring
```
5. Import this dashboard: https://grafana.com/grafana/dashboards/1860 to grafana.

That's it!

Expand All @@ -28,8 +19,8 @@ If you want to add more servers to prometheus, make these steps:
git clone https://github.com/digitalstudium/grafana-docker-stack.git
docker stack deploy -c grafana-docker-stack/node-exporter.yml node-exporter
```
2. Add these servers to `/var/lib/docker/volumes/monitoring_prom-configs/_data/prometheus.yml` file to `- targets: ['node-exporter:9100']` list of `- job_name: 'node-exporter'` section, like `- targets: ['node-exporter:9100', 'server1:9100', 'server2:9100', '...']`
2. Add these servers to `configs/prometheus/prometheus.yml` file to `- targets: ['node-exporter:9100']` list of `- job_name: 'node-exporter'` section, like `- targets: ['node-exporter:9100', 'server1:9100', 'server2:9100', '...']`
3. Reload prometheus config via this command:
```
```bash
docker ps | grep prometheus | awk '{print $1}' | xargs docker kill -s SIGHUP

```
18 changes: 18 additions & 0 deletions configs/alertmanager.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
route:
receiver: 'telegram'
routes:
# All alerts with severity=warning or severity=critical
# are dispatched to the telegram receiver.
- receiver: 'telegram'
group_wait: 10s
matchers:
- severity=~"warning|critical"

receivers:
- name: 'telegram'
telegram_configs:
- bot_token: "00000:ddddddddddddddddddd"
chat_id: -3453435345

# https://api.telegram.org/botINSERT_BOT_ID_HERE/getUpdates - to get chat_id
# amtool --alertmanager.url=http://localhost:9093/ alert add alertname="Test alert" severity="warning" job="test-job" - to send test alert
Loading