Hello,
I configured cAdvisor, Prometheus, and Grafana tools using this link.
On the remote host, I created a docker-compose.yml file with the following contents:
services:
cadvisor:
container_name: cadvisor
image: gcr.io/cadvisor/cadvisor:latest
network_mode: "host"
ports:
- "8080:8080"
volumes:
- "/:/rootfs:ro"
- "/var/run:/var/run:ro"
- "/sys:/sys:ro"
- "/var/lib/docker/:/var/lib/docker:ro"
- "/dev/disk/:/dev/disk:ro"
privileged: true
devices:
- "/dev/kmsg"
prometheus:
container_name: prometheus
image: prom/prometheus:latest
network_mode: "host"
ports:
- "9090:9090"
volumes:
- "./prometheus.yml:/etc/prometheus/prometheus.yml"
privileged: true
depends_on:
- cadvisor
Then I created a prometheus.yml file with the following contents:
global:
scrape_interval: 15s #Scrape interval to every 15 seconds.
evaluation_interval: 15s #Evaluate rules every 15 seconds.
scrape_configs:
- job_name: "prometheus"
# metrics_path defaults to '/metrics'
static_configs:
- targets: ["localhost:9090"]
- job_name: "cadvisor"
static_configs:
- targets: ["localhost:8080"]
Now, in the targets section on the monitoring server, should I enter the IP address of the remote server? Something like the below:
global:
scrape_interval: 15s #Scrape interval to every 15 seconds.
evaluation_interval: 15s #Evaluate rules every 15 seconds.
scrape_configs:
- job_name: "prometheus"
# metrics_path defaults to '/metrics'
static_configs:
- targets: ["localhost:9090"]
- targets: ["Remote_Host:8080"]
- job_name: "cadvisor"
static_configs:
- targets: ["localhost:8080"]
- targets: ["Remote_Host:8080"]
Any idea welcome.
Thank you.