In the start script of VM to monitor (replace publicIpTool with the remote server public IP address):
#!/bin/bash apt-get install -y \ apt-transport-https \ ca-certificates \ curl \ software-properties-common curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable" apt-get update apt-get install -y docker-ce curl -XPOST 'http://`+publicIpTool+`:8086/query' --data-urlencode 'q=CREATE DATABASE "`+testName+`"' git clone https://github.com/ansjin/docker-node-monitoring.git FILE="docker-node-monitoring/local/prometheus/prometheus.yml" cat <<EOT >> $FILE remote_write: - url: "http://`+publicIpTool+`:8086/api/v1/prom/write?db=`+testName+`&u=root&p=root" remote_read: - url: "http://`+publicIpTool+`:8086/api/v1/prom/read?db=`+testName+`&u=root&p=root" EOT cd docker-node-monitoring/local/scripts sh ./deploy_app.sh