Add cadvisor support with monitoring stack: alertmanager, loki, node-red, promtail

This commit is contained in:
Freazzzing
2026-02-04 13:21:16 +00:00
parent 0d85bd53aa
commit 338e0b0f19
13 changed files with 241 additions and 0 deletions

View File

@ -0,0 +1,7 @@
---
# Loki connection
loki_host: 192.168.0.112
loki_port: 3100
# Promtail settings
promtail_port: 9080

View File

@ -0,0 +1,31 @@
---
- name: Create Promtail directories
file:
path: /etc/promtail
state: directory
owner: root
group: root
mode: '0755'
- name: Deploy Promtail configuration
template:
src: promtail-config.yml.j2
dest: /etc/promtail/promtail-config.yml
owner: root
group: root
mode: '0644'
- name: Run Promtail container (using host network)
docker_container:
name: promtail
image: grafana/promtail:latest
state: started
restart_policy: always
network_mode: host # <-- КЛЮЧЕВОЕ ИЗМЕНЕНИЕ
volumes:
- /var/log:/var/log:ro
- /var/lib/docker/containers:/var/lib/docker/containers:ro
- /etc/promtail/promtail-config.yml:/etc/promtail/config.yml
command: -config.file=/etc/promtail/config.yml
pid_mode: host
tags: promtail

View File

@ -0,0 +1,28 @@
server:
http_listen_port: 9080
grpc_listen_port: 0
positions:
filename: /tmp/positions.yaml
clients:
- url: http://localhost:3100/loki/api/v1/push # Теперь localhost работает
scrape_configs:
- job_name: system
static_configs:
- targets:
- localhost
labels:
job: varlogs
__path__: /var/log/*log
host: "{{ inventory_hostname }}"
- job_name: docker
static_configs:
- targets:
- localhost
labels:
job: docker
__path__: /var/lib/docker/containers/*/*log
host: "{{ inventory_hostname }}"