feat(monitoring): заменить Prometheus на vmalert
ansible-core-mon / deploy (push) Successful in 37s
ansible-core-net / deploy (push) Successful in 56s
ansible-core-secrets / deploy (push) Successful in 16s
ansible-ger-nod-02 / deploy (push) Successful in 1m22s
ansible-opnsense / deploy (push) Successful in 6s
ansible-rus-central / deploy (push) Successful in 39s
ansible-core-mon / deploy (push) Successful in 37s
ansible-core-net / deploy (push) Successful in 56s
ansible-core-secrets / deploy (push) Successful in 16s
ansible-ger-nod-02 / deploy (push) Successful in 1m22s
ansible-opnsense / deploy (push) Successful in 6s
ansible-rus-central / deploy (push) Successful in 39s
Алерты считаются по VictoriaMetrics и уходят в тот же Alertmanager, второй сбор метрик больше не нужен. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
28b8bcf708
commit
57aa12b9c5
10 files changed
+59
-79
No files matched your search
@@ -1,23 +1,6 @@
|
||||
name: monitoring
|
||||
|
||||
services:
|
||||
prometheus:
|
||||
image: prom/prometheus:v3.2.1
|
||||
container_name: monitoring-prometheus
|
||||
restart: unless-stopped
|
||||
command:
|
||||
- "--config.file=/etc/prometheus/prometheus.yml"
|
||||
- "--storage.tsdb.path=/prometheus"
|
||||
- "--storage.tsdb.retention.time={{ prometheus_retention }}"
|
||||
- "--web.enable-lifecycle"
|
||||
volumes:
|
||||
- ./prometheus:/etc/prometheus:ro
|
||||
- ./prometheus_data:/prometheus
|
||||
ports:
|
||||
- "9090:9090"
|
||||
depends_on:
|
||||
- alertmanager
|
||||
|
||||
alertmanager:
|
||||
image: prom/alertmanager:v0.28.1
|
||||
container_name: monitoring-alertmanager
|
||||
@@ -76,7 +59,7 @@ services:
|
||||
ports:
|
||||
- "3000:3000"
|
||||
depends_on:
|
||||
- prometheus
|
||||
- vmsingle
|
||||
|
||||
vmsingle:
|
||||
image: {{ victoriametrics_image }}
|
||||
@@ -85,6 +68,7 @@ services:
|
||||
restart: unless-stopped
|
||||
command:
|
||||
- --storageDataPath=/victoria-metrics-data
|
||||
- --retentionPeriod={{ victoriametrics_retention }}
|
||||
volumes:
|
||||
- ./victoria-metrics-data:/victoria-metrics-data
|
||||
ports:
|
||||
@@ -138,4 +122,23 @@ services:
|
||||
- vmsingle
|
||||
- cadvisor
|
||||
|
||||
vmalert:
|
||||
image: {{ vmalert_image }}
|
||||
container_name: monitoring-vmalert
|
||||
restart: unless-stopped
|
||||
command:
|
||||
- -datasource.url=http://vmsingle:8428
|
||||
- -notifier.url=http://alertmanager:9093
|
||||
- -rule=/etc/vmalert/alerts.yml
|
||||
- -evaluationInterval=15s
|
||||
- -configCheckInterval=30s
|
||||
- -httpListenAddr=0.0.0.0:8880
|
||||
volumes:
|
||||
- ./vmalert:/etc/vmalert:ro
|
||||
ports:
|
||||
- "127.0.0.1:8880:8880"
|
||||
depends_on:
|
||||
- vmsingle
|
||||
- alertmanager
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ datasources:
|
||||
uid: prometheus
|
||||
type: prometheus
|
||||
access: proxy
|
||||
url: http://prometheus:9090
|
||||
isDefault: true
|
||||
url: http://vmsingle:8428
|
||||
isDefault: false
|
||||
jsonData:
|
||||
timeInterval: 15s
|
||||
|
||||
@@ -15,7 +15,7 @@ datasources:
|
||||
type: prometheus
|
||||
access: proxy
|
||||
url: http://vmsingle:8428
|
||||
isDefault: false
|
||||
isDefault: true
|
||||
jsonData:
|
||||
timeInterval: 15s
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
global:
|
||||
scrape_interval: 15s
|
||||
evaluation_interval: 15s
|
||||
|
||||
rule_files:
|
||||
- "/etc/prometheus/alerts.yml"
|
||||
|
||||
alerting:
|
||||
alertmanagers:
|
||||
- static_configs:
|
||||
- targets:
|
||||
- "alertmanager:9093"
|
||||
|
||||
scrape_configs:
|
||||
- job_name: "prometheus"
|
||||
static_configs:
|
||||
- targets: ["localhost:9090"]
|
||||
|
||||
- job_name: "{{ monitoring_scrape_job_name }}"
|
||||
static_configs:
|
||||
{% for target in monitoring_scrape_targets %}
|
||||
- targets:
|
||||
- "{{ target.address }}:{{ target.port }}"
|
||||
labels:
|
||||
host: "{{ target.name }}"
|
||||
env: "{{ target.env }}"
|
||||
{% endfor %}
|
||||
@@ -5,3 +5,10 @@
|
||||
labels:
|
||||
instance: "{{ inventory_hostname }}"
|
||||
cluster: "{{ vmagent_cluster }}"
|
||||
{% for target in monitoring_scrape_targets if target.name not in vmagent_central_scrape_skip %}
|
||||
- targets: ["{{ target.address }}:{{ target.port }}"]
|
||||
labels:
|
||||
instance: "{{ target.name }}"
|
||||
cluster: "{{ vmagent_cluster }}"
|
||||
host: "{{ target.name }}"
|
||||
{% endfor %}
|
||||
Reference in new issue
Block a user