In this blog we will see step by step to install Cadvisor, NodeExporter, Prometheus, Grafana to monitor docker containers and its hosts.
Note : We are going to use only docker images for all the tools.
Requirements:
Docker running Linux server : 1
Step 1:
Deploy Cadvisor in docker:
Cadvisor : It provides container resource usage and performance characteristics of their running containers.
Execute the below docker command in linux server,
# docker run -d -p 8080:8080 -v /:/rootfs:ro -v /var/run:/var/run:rw -v /sys:/sys:ro -v /var/lib/docker/:/var/lib/docker:ro --name=cadvisor google/cadvisor:latest
We can access Cadvisor in browser by http://server-IP:8080
Step 2:
Deploy Node-Exporter in docker:
Node-Exporter : It helps to measure various machine resources like as CPU, memory, disk and network utilization.
Execute the below docker command in linux server,
# docker run -d -p 9100:9100 --name=node-exporter prom/node-exporter
We can access Node-Exporter metrics in browser by http://server-IP:9100/metrics
Step 3:
Deploy Prometheus in docker:
To deploy Prometheus, we need to create configuration file for prometheus like below,
#vi /root/config/prometheus.yml
global:
scrape_interval: 15s
evaluation_interval: 15s
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['Host-IP:9090']
labels:
alias: 'prometheus'
- job_name: 'cadvisor'
static_configs:
- targets: ['Host-IP:8080']
labels:
alias: 'cadvisor'
- job_name: 'node-exporter'
static_configs:
- targets: ['Host-IP:9100']
labels:
alias: 'node-exporter'
Save the file.
Here Cadvisor, Node-exporter metrics details are given.
Now run the Prometheus docker command,
# docker run -d -p 9090:9090 -v /root/config/prometheus.yml:/etc/prometheus/prometheus.yml --name=prometheus prom/prometheus
We can access Prometheus metrics in browser by http://server-IP:9090/metrics
Post a Comment