Assuming 192.168.56.107
is db node aliased as db1
in Prometheus config.
git clone https://github.com/roman-vynar/webinar.docker.git
cd webinar.docker
mkdir -p docker_shared/{prometheus,grafana}
chcon -Rt svirt_sandbox_file_t docker_shared # if running selinux
docker build -t monitor monitor/
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
mysql> GRANT REPLICATION CLIENT, PROCESS ON *.* TO 'prom'@'%' identified by 'abc123';
mysql> GRANT SELECT ON performance_schema.* TO 'prom'@'%';
docker build -t dbnode dbnode/
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