Skip to content

Docker containers with Prometheus+Grafana and Prometheus exporters

Notifications You must be signed in to change notification settings

roman-vynar/webinar.docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Docker container with Grafana + Prometheus

Assuming 192.168.56.107 is db node aliased as db1 in Prometheus config.

Preparation

git clone https://github.com/roman-vynar/webinar.docker.git
cd webinar.docker

Create persistent storage (optional):

mkdir -p docker_shared/{prometheus,grafana}
chcon -Rt svirt_sandbox_file_t docker_shared  # if running selinux

Monitor container

Build docker image:

docker build -t monitor monitor/ 

Run container:

docker run -d -p 3000:3000 -p 9090:9090 -e DB_NODE_IP=192.168.56.107 --name prom monitor

Alternatively, with persistent storage:

docker run -d -p 3000:3000 -p 9090:9090 --name prom \
    -v $PWD/docker_shared/prometheus:/opt/prometheus/data \
    -v $PWD/docker_shared/grafana:/var/lib/grafana \
    -e DB_NODE_IP=192.168.56.107 monitor

DB node container

Create MySQL user on the host machine for access by mysqld_exporter:

mysql> GRANT REPLICATION CLIENT, PROCESS ON *.* TO 'prom'@'%' identified by 'abc123';
mysql> GRANT SELECT ON performance_schema.* TO 'prom'@'%';

Build docker image:

docker build -t dbnode dbnode/

Run container:

docker run -d -p 9100:9100 -p 9104:9104 -p 9204:9204 -p 9304:9304 --net="host" \
    -e DATA_SOURCE_NAME="prom:abc123@(192.168.56.107:3306)/" --name exp dbnode 

About

Docker containers with Prometheus+Grafana and Prometheus exporters

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published