Add prometheus monitoring
This commit is contained in:
parent
bd0d487c06
commit
0b9b2a90d1
4 changed files with 50 additions and 2 deletions
|
@ -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"
|
||||
},
|
||||
]
|
||||
}
|
||||
|
|
23
roles/monitoring-client/files/docker-compose.yaml
Normal file
23
roles/monitoring-client/files/docker-compose.yaml
Normal 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"
|
||||
|
19
roles/monitoring-client/tasks/main.yaml
Normal file
19
roles/monitoring-client/tasks/main.yaml
Normal 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
|
||||
|
|
@ -12,5 +12,6 @@
|
|||
hosts: nextcloud
|
||||
roles:
|
||||
- { role: docker, become: yes }
|
||||
- { role: monitoring-client, become: yes }
|
||||
- { role: nextcloud, become: yes }
|
||||
|
||||
|
|
Loading…
Reference in a new issue