Setting Up a Performance Monitoring Stack with Docker, JMeter, InfluxDB, and Grafana
Deploying InfluxDB via Docker
Ensure Docker is installed on the Linux host. Pull the InfluxDB image and start a container.
docker pull influxdb:1.8.6
docker run -d --name influxdb_jmeter -p 8086:8086 influxdb:1.8.6
Accesss the container's shell and initialize the database.
docker exec -it influxdb_jmeter /bin/bash
influx
Within the InfluxDB CLI:
CREATE DATABASE perf_metrics;
SHOW DATABASES;
USE perf_metrics;
SELECT * FROM system;
Configuring JMeter for Metrics Export
Add a Backend Listener to your test plan.
- Implementation:
org.apache.jmeter.visualizers.backend.influxdb.InfluxdbBackendListenerClient - InfluxDB URL:
http://<host_ip>:8086/write?db=perf_metrics - Application Name:
WebAppLoadTest - Measurement Name:
perf_metrics - Test Title:
API Stress Test
Execute the test plan and verify data insertion into the perf_metrics database.
Setting Up Grafana with Docker
Deploy Grafana using Docker.
docker pull grafana/grafana-enterprise
docker run -d --name grafana_monitor -p 3000:3000 grafana/grafana-enterprise
Access the Grafana web interface at http://localhost:3000 (default credentials: admin/admin). Skip the password change prompt.
Configure the data source:
- Type: InfluxDB
- URL:
http://<influxdb_host_ip>:8086 - Access: Browser
- Database:
perf_metrics
Save and test the connection. Import a dashboard template (e.g., ID 5496) and select the configured InfluxDB data source.