Add prometheus monitoring

This commit is contained in:
Erik Stambaugh 2022-01-03 08:08:38 -08:00
parent bd0d487c06
commit 0b9b2a90d1
4 changed files with 50 additions and 2 deletions

View file

@ -88,12 +88,17 @@ module "nextcloud_sg" {
{
rule = "http-80-tcp"
cidr_blocks = "0.0.0.0/0"
# cidr_blocks = "${chomp(data.http.myip.body)}/32"
},
{
rule = "https-443-tcp"
cidr_blocks = "0.0.0.0/0"
# cidr_blocks = "${chomp(data.http.myip.body)}/32"
},
{
from_port = 9100
to_port = 9100
protocol = "tcp"
description = "Prometheus node-exporter"
cidr_blocks = "${chomp(data.http.myip.body)}/32"
},
]
}

View file

@ -0,0 +1,23 @@
---
version: "2"
services:
prometheus-node-exporter:
image: prom/node-exporter:latest
container_name: prometheus-node-exporter
restart: unless-stopped
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
command:
- '--path.procfs=/host/proc'
- '--path.rootfs=/rootfs'
- '--path.sysfs=/host/sys'
- '--collector.filesystem.mount-points-exclude=^/(sys|proc|dev|host|etc)($$|/)'
expose:
- 9100
ports:
- "9100:9100"

View file

@ -0,0 +1,19 @@
---
- name: create paths
file:
path: /srv/monitoring-client
state: directory
recurse: true
- name: monitoring docker-compose
copy:
src: files/docker-compose.yaml
dest: /srv/monitoring-client/docker-compose.yaml
register: nginxconf
- name: launch monitoring client
command: docker-compose up -d
args:
chdir: /srv/monitoring-client

View file

@ -12,5 +12,6 @@
hosts: nextcloud
roles:
- { role: docker, become: yes }
- { role: monitoring-client, become: yes }
- { role: nextcloud, become: yes }