monitoring: add initial implementation of prometheus

This commit is contained in:
Iurii Tatishchev 2023-04-07 23:15:58 -07:00
parent bd8e1b8e38
commit 9844a1ab5c
Signed by: CaZzzer
GPG Key ID: 9A156B7DA6398968
5 changed files with 50 additions and 0 deletions

View File

@ -53,3 +53,13 @@ services:
- /var/log:/var/log:ro - /var/log:/var/log:ro
tmpfs: tmpfs:
- /tmp - /tmp
prometheus:
image: prom/prometheus:latest
container_name: prometheus
restart: unless-stopped
user: "{{ remote_uid }}"
volumes:
- ./prometheus_config:/etc/prometheus:ro
- {{ base_volume_path }}/monitoring/prometheus_configs:/etc/prometheus/extra:ro
- {{ base_volume_path }}/monitoring/prometheus:/prometheus

View File

@ -8,3 +8,11 @@ datasources:
uid: loki uid: loki
url: http://loki:3100 url: http://loki:3100
editable: false editable: false
- name: Prometheus
type: prometheus
version: 1
access: proxy
uid: prometheus
url: http://prometheus:9090
editable: false

View File

@ -0,0 +1,31 @@
global:
scrape_interval: 15s
evaluation_interval: 15s
external_labels:
monitor: "{{ ansible_host }}"
scrape_configs:
- job_name: "prometheus"
static_configs:
- targets: ["localhost:9090"]
- job_name: "node"
static_configs:
- targets: ["{{ ansible_host }}:9100"]
- job_name: "loki"
static_configs:
- targets: ["loki:3100"]
- job_name: "promtail"
static_configs:
- targets: ["promtail:9080"]
rule_files:
- "/etc/prometheus/extra/rules/*.yml"
- "/etc/prometheus/extra/rules/*.json"
scrape_config_files:
- "/etc/prometheus/extra/scrape_configs/*.yml"
- "/etc/prometheus/extra/scrape_configs/*.json"

View File

@ -5,6 +5,7 @@
- docker-ce - docker-ce
- docker-compose-plugin - docker-compose-plugin
- firewalld - firewalld
- prometheus-node-exporter
state: latest state: latest
- name: Upgrade Debian packages - name: Upgrade Debian packages