Skip to content
Snippets Groups Projects
Commit 57fea714 authored by Pierre Michiels's avatar Pierre Michiels
Browse files

19.11.20 10:56

parent 68b94fe3
Branches
No related tags found
No related merge requests found
TP6 (13.11.2020) TP6 (13.11.2020)
Monitoring Monitoring
Prometheus permet de faire du monitoring sur toutes les containers docker sur une seule machine et même machine.
Il est donc impossible de surveiller le container d'une machine différente.
(https://phoenixnap.com/blog/docker-container-monitoring-tools)
Pour installer prometheus, j'ai du créer un fichier prometheus.yml avec le contenu suivant
scrape_configs:
- job_name: nginx_survey
scrape_interval: 5s
static_configs:
- targets:
- 172.28.100.90:9090
\ No newline at end of file
FROM prom/prometheus:latest
RUN rm /etc/prometheus/prometheus.yml
COPY prometheus.yml /etc/prometheus/
\ No newline at end of file
# scrape_configs:
# - job_name: nginxAndWorkers
# # Override the global default and scrape targets from this job every 5 seconds.
# scrape_interval: 5s
# static_configs:
# - targets: ['172.28.100.90:8000', '172.28.100.51:8000', '172.28.100.111:8000', '172.28.100.72:8000']
# labels:
# group: 'workers'
# - targets: ['172.28.100.90:9090']
# labels:
# group: 'reverse_proxy'
scrape_configs:
- job_name: cadvisor
scrape_interval: 5s
static_configs:
- targets:
- cadvisor:8080
\ No newline at end of file
version: '3.4'
services:
prometheus:
image: 'prom/prometheus:latest'
container_name: prometheus
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
command:
- '--config.file=/etc/prometheus/prometheus.yml'
ports:
- '9090:9090'
cadvisor:
image: 'google/cadvisor:latest'
container_name: cadvisor
volumes:
- /:/rootfs:ro
- /var/run:/var/run:ro
- /sys:/sys:ro
- /var/lib/docker/:/var/lib/docker:ro
- /dev/disk:/dev/disk/:ro
ports:
- '8080:8080'
\ No newline at end of file
global:
scrape_interval: 15s
evaluation_interval: 15s
alerting:
alertmanagers:
- static_configs:
- targets:
# whatever you want
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['prometheus:9090']
labels:
alias: 'prometheus'
- job_name: 'cadvisor'
static_configs:
- targets: ['cadvisor:8080']
labels:
alias: 'cadvisor'
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment