Skip to main content

Deploy InfluxDB and Grafana for monitoring JMeter

When running JMeter in non-gui mode current state of test is known only through Jmeter log that is updated overtime.

Grafana provides GUI for monitoring live metrics during JMeter test execution if configured with "backend listener plugin", data from test is stored into InfluxDB which can be access in further point of time.

We are going to deploy InfuxDB and Grafana using Kubernetes Statefulset configuration with a minimum of 1 replica running at all time, even if a pod crashed new pod replaces the existing in no time.

You can deploy InfluxDB and Grafana using create.sh script from grafana-influx folder, this will persist data in same folder under grafana and influxdb folder under the same directory.

InfluxDB

InfluxDB is not accessible from outside but as it is a part of same cluster Grafana and JMeter will be able to access InfluxDB using service name configured in kubernetes.

database : jmeter
username: admin
password: admin
service name : influxdb
port: 8086

Grafana 

Grafana is accessible on port http://localhost:30000/

username: admin
password: admin

On your first login with above credentials you will be asked to reset the password, with your preferred  one. 

Next we have to configure Influx DB as datasource in Grafana, use the below.

url: influxdb:8086
database : jmeter
username: admin
password: password123

Once the above configuration is done we are good to use the Grafana for Live monitoring, there are may dashboards available for JMeter test monitoring, you can create your own as per your requirement. I am using dashboard which is available in Grafana dashboards site

With all the configuration done once you start the test with backend listner plugin configured with InfluxDB details mentioned above you will start seeing graphs of live test. We will be creating JMeter Pods in same namespace as of InfluxDB so we can send our test stats without any issue.

Configuration Setting for InfluxDB and Grafana:


influxdb.yaml.bak

This is the file that is being used by create.sh to create the Kubernetes config file. Below are options that can be changed. 
  • requests should never be more than limits.  
  • CPU is allocated in millicores
    • 1 physical core = 1000 millicores 
  • Memory can be allocated in MB or GB
    • MB  = Mi
    • GB = Gi

env:
- name: INFLUXDB_DB
  value: jmeter
- name: INFLUXDB_ADMIN_USER
  value: admin
- name: INFLUXDB_ADMIN_PASSWORD
  value: password123
resources:
  limits:
cpu: 500m
memory: 512Mi
  requests:
cpu: 500m
memory: 512Mi

grafana.yaml.bak

It is similar to Influx DB config, but the password should be changed on first login.

env:
- name: JVM_ARGS
  value: "-Xms512m -Xmx512m"
- name: GF_SECURITY_ADMIN_USER
  value: admin
- name: GF_SECURITY_ADMIN_PASSWORD
  value: admin
- name: GF_INSTALL_PLUGINS
  value: grafana-clock-panel,grafana-worldmap-panel,grafana-piechart-panel
resources:
  limits:
cpu: 500m
memory: 512Mi
  requests:
cpu: 500m
memory: 512Mi