Jmeter-Grafana-influxdb-docker Live monitoring

In this article we are going to make a Docker Image containing grafana, influxdb. The target is, we have seen making live dashboard in Ubuntu & windows in VM, and we will make docker images to do the same. (no need VMs)

For this we need to have docker in our PC. So, how to install docker in Ubuntu PC , you may see from previous post. For other platform, you may follow this.

I will follow simple steps, to do. The plan is to have two different containers running influxdb and grafana and when we run Jmeter, this actually storing results in influxdb and grafana dashboard is showing.

Now, to know more about grafana dashboard configuration or influxdb configuration, i request you to read my this post

Make a docker image & run container for influxdb:

I am not using default influxdb container as we will use our own configuration files to run with.

Step 1 : Make a folder name influxdb
Step 2 : Create a file name Dockerfile & copy past all from this source. (basic scripts to build an image for influxdb)

What I did here ? 
1. Using ubuntu  14.04 images
2. Install VIM, wget, curl , in case you need those software . I prefer those for editing or downloading for long term image using. Only wget is mandatory to download
3. Install Key and certificates (basic for influxdb)
4. Download, install & remove influxdb installer.
5. Expose our necessary port(see my this post for knowing about default port) which will work with localhost.
6. Setting some environment variable
7. Putting CMD command so that when container will run, this command can run influxdb with our given configuration.

Step 3 : create a configuration file(influxdb.conf) or you may copy from my this post or from repository.

Step 4 (optional): Make a build.sh(bat file in windows) file and add build command line
docker build --tag 'influx/influxd:jmeter' --no-cache=true .

if you dont add this file, you have use this command for building.

Step 5 : (optional) Make a run-influx-docker.sh(bat file in windows) file and add build command line

docker run -i -p 8083:8083 -p 8086:8086 -p 2003:2003 influx/influxd:jmeter

if you dont add this file, you have use this command for building.

Step 6 : From command line
a. Run build.sh and
b. Run run-influx-docker.sh

(if you dont make those bat file, run command in command line for that)

Now, check influxdb like following my this post.

Make a docker image & run container for grafana: 

I am using default grafana docker image(grafana/grafana:latest) . I pretty much follow the items form here, just some optimized manner(following mandatory steps). This is just default steps for grafana container , no spatial configuration.  So, like as influx db

Step 1 : Create a folder , named grafana
Step 2 : Create a file, named Dockerfile and put this inside

What I am doing?, In brief  , Like as before
1. installing vim, wget, curl
2. installing grafana
3. Exposing in port localhost:3000
4. Assigning volume
5. Having entry point gr.sh

Step 3 : Make a file gr.sh (entry point file, mentioned in Dockerfile) and put this inside. you can see, it only executes grafana server with defined path.

Step 4 : Make a file GRAFANA_VERSION with no extension(used as argument in Dockerfile) , edit with latest version of grafana, like this.

Step 5 : Make a file build.sh which actually contains build instructions (like as influxdb) following this . You can see, it is checking version and if not found, will download from docker remote registry.

Step 6 : Make a file run-grafana-docker.sh to run this container with this commands.

Step 7 : From command line, run run-grafana-docker.sh

For the first time it will download and install and after that everything is okay.

Now, check grafana like following my this post. You need to login, add database and organize dashboard for jmeter monitoring. 

Jmeter-Grafana docker Live monitoring :  This was my settings like as my this post.



And, if you run jmeter, you can check them in dashboard. Again for dashboard configuration, use steps from my this post.


grafana :




Tools around Docker I use : (except command line)
1. ATOM text editor with docker file support
Or  (better solution)
 Sublime text with docker plug-ins

2. Eclipse with docker tooling (for better visualize images & containers, like VM managers)




In whole example, I am using this following properties/parameters
1. Name of influxdb Image -> influx/influxd:jmeter
2. Name of grafan image -> grafana/grafana:latest
3. Grafana Expose URL : localhost:300
4. influxdb expose URL , all in localhost with ports 8083, 8086, 8088, 8091, 2003
5. No password for influxdb
6. Grafana password , default admin admin.

My Both docker resources are in this repository. I put an extra influxdb configuration "configure.sh", in case you need manually configure for db initiation.

Note : All examples are inspired by
1. https://github.com/influxdata/influxdb-docker
2. https://github.com/grafana/grafana-docker




----- Thanks.. :)