This commit is contained in:
bee
2026-04-27 15:07:54 +02:00
commit 56d73c7c6f
34 changed files with 2295 additions and 0 deletions
@@ -0,0 +1,33 @@
networks:
monitoring:
external: false
services:
prometheus:
image: docker.io/prom/prometheus
container_name: prometheus
restart: unless-stopped
ports:
- '9090:9090'
volumes:
- prometheus-data:/prometheus
- /opt/monitoring/prometheus.yml:/etc/prometheus/prometheus.yml
networks:
- monitoring
grafana:
image: docker.io/grafana/grafana
container_name: grafana
restart: unless-stopped
ports:
- '4000:4000'
volumes:
- grafana-storage:/var/lib/grafana
environment:
- GF_SECURITY_SECRET_KEY={{ grafana_secret }}
- GF_SERVER_DOMAIN=grafana.secretbee.buzz
- GF_SERVER_ROOT_URL=https://grafana.secretbee.buzz/
- GF_SERVER_HTTP_PORT=4000
- GF_SERVER_PROTOCOL=HTTP
networks:
- monitoring
+56
View File
@@ -0,0 +1,56 @@
- name: Prometheus
hosts: pi
become: true
vars:
grafana_secret: !vault |
$ANSIBLE_VAULT;1.1;AES256
38343463346232356634353236356534666166626665663237306130623336373062363563386537
6665356165346134643235383164383266373363316262310a613332386564636430643561373463
36346437353963333839656163623933616662326132373036636166616538343966356361636164
3035656163616631330a663363343363643065356535356633623638376430326539363536666638
65333930613135333364383462363233386662386531323935353932373465363234
tasks:
- name: Install podman
ansible.builtin.apt:
name: podman
state: present
- name: Install podman-compose
ansible.builtin.apt:
name: podman-compose
state: present
- name: Install prometheus-node-exporter
ansible.builtin.apt:
name: prometheus-node-exporter
state: present
- name: Create prometheus config directory
ansible.builtin.file:
path: /opt/monitoring
state: directory
mode: '0755'
- name: Copy config
ansible.builtin.copy:
src: prometheus_config.yml
dest: /opt/monitoring/prometheus.yml
mode: '0644'
- name: Copy compose
ansible.builtin.template:
src: docker-compose.yml.j2
dest: /opt/monitoring/docker-compose.yml
mode: '0644'
- name: Compose down
changed_when: true
ansible.builtin.command:
cmd: podman-compose down
chdir: /opt/monitoring
- name: Compose up
changed_when: true
ansible.builtin.command:
cmd: podman-compose up -d
chdir: /opt/monitoring
@@ -0,0 +1,11 @@
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
- job_name: node
static_configs:
- targets: ['host.containers.internal:9100']