As we all know that Most of the Companies are investing in best resources instead of licensed tools and moving towards open source technologies, We as a Performance engineers also has to adopt and utilize open source tools and technologies.
Download and install pre-compiled Zabbix agents Zabbix. Join Zabbix Summit Online 2020. Grafana is an open-source dashboard tool that can be used to display metrics of different systems. It can be integrated with a variety of data sources.
It is quite difficult to store JMeter test results for longer duration and to monitor JMeter test in non-gui mode. One of the solution is Grafana and InfluxDB.
Was building from wrong Dockerfile before.
In this article, I will explain step by step, how to install and configure Grafana and InfluxDB with JMeter in MAC and Windows OS.
InfluxDB Setup with JMeter
Windows OS
- First we have to download InfluxDB using following URL Download InfluxDB
- Unzip the downloaded file. You will see the folder structure like below
3. Open influxdb.conf file and scroll down till graphite section. You will find like below
4. Uncomment few configurations highlighted in below screenshot and change the value of enabled tag to true
5. Execute influxd exe from downloaded folder. This is to start the InfluxDB service.
6. Execute influx exe from downloaded folder to connect to Influx DB and create a database schema
7. Execute below commands to create a new database schema
- create database jmeter_demo; (jmeter_demo is the database schema name)
- show databases;
8. Next step is to add a backend listener in JMeter to send test stats to InfluxDB during execution. Do the configuration same as below screenshot. (Here 8086 is default port used by InfluxDB for web access)
- influxdbURL --> It should be the URL where InfluxDB is hosted followed by database name.
- application --> Mention any name to identify multiple applications test results.
- measurement --> Here jmeter is the table name where all the test stats will be written.
- samplersRegex --> .* will write all the transaction data into InfluxDB.
Make sure you are selecting InfluxDB backend listener client in Dropdown as below:
9. Now JMeter is successfully configured to send data stats to InfluxDB.
- To validate stats in Influx DB, Run a JMeter test and open influx exe application from downloaded folder
Execute following commands
- use jmeter_demo (Here Jmeter_demo is the database name which we created in step 7).
- select * from jmeter; (Here jmeter is a table name)
- you will be able to see the data in InfluxDB like below
MAC OS
It is quite easy to install InfluxDB and Grafana in MAC if you have Homebrew installed in your system. if not, Download Brew.
- Execute below commands to download InfluxDB
- brew update
- brew install influxdb
2. Run below commands after successful installation of InfluxDB
- ln -sfv /usr/local/opt/influxdb/*.plist ~/Library/LaunchAgents
- launchctl load ~/Library/LaunchAgents/homebrew.mxcl.influxdb.plist
3. To Verify that InfluxDB is running or not, Execute below commands in terminal
- Influx
- SHOW DATABASES
- Create database jmeter_demo
4. Make few changes in the InfluxDB configuration file. File Path --> /usr/local/etc
- influxd config
- Refer step 4 in windows configuration as it is same.
5. Restart Influx DB
- brew services restart influxdb
6. Refer step 8 and 9 from windows installation to add a backend listener in Jmeter.
-----------------------------------------
Now as the data is reaching to InfluxDB successfully, Next step is to download Grafana and setup dashboard.
Download Grafana
Windows OS:
- Download Grafana
- Unzip the downloaded file, go to bin folder and run the grafana-server exe. It will start the grafana server and then you can setup InfluxDB in it.
Note: influxd and grafana-server should be running always to push the JMeter data to InfluxDB and to access Grafana portal.
Mac OS:
![Grafana Grafana](https://d33np9n32j53g7.cloudfront.net/assets/stacks/lampstack/img/lampstack-stack-110x117-1381cbdb85feb167f01d35476f6995beb40de990857ace59417afd13b2ace11b.png)
- Execute below commands
- brew install grafana
- brew services start grafana
----------------------------------
Setup Grafana and Dashboards
- To access Grafana, use http://localhost:3000/ (Grafana by default use 3000 port).
- login in Grafana using admin/admin as username and password.
- It will ask for password change, You can use the same admin as password.
- Next step is to add InfluxDB data source in Grafana.
- click on add data source.
- select InfluxDB and enter all the details as per below screenshot and click save. Make Sure you are giving 'Jmeter' in Name textBox as below reference dashboard is using datasource called 'Jmeter'.
7. Now InfluxDB is connected to Grafana, Next step is to create a dashboard to view test stats in graphical view.
- Go to dashboard home.
- Click on new dashboard. Here you can add multiple panels like graphs, tables etc..
- Click on graph then click on edit in panel title in the chart heading.
- Now you can write a query to fetch the required data from InfluxDB like below (Here jmeter represents table name and field(avg) represents average transaction response time).
Grafana Dashboard for JMeter test
I have created a dashboard to monitor JMeter test results. You can import it using following steps.
- Click on Dashboard --> Manage --> Import
- Download Dashboard JSON from following Git repository and click load.
- Make sure Datasource name is set to 'Jmeter' and save.
I hope you will find this article helpful. You can reach out to me if you face any issues while configuring Grafana.
Integrate Zabbix with Grafana in just a few steps. Visualize collected data not only in native Zabbix frontend, but also in Grafana.
Watch the video now.
Contents
I. Introduction (2:12)
II. Grafana integration (4:18)
II. Grafana integration (4:18)
- Installation (4:18)
- Getting started (7:51)
- Adding a data source (10:28)
- Creating a dashboard (12:41)
III. Conclusion (16:09)
Introduction
Today I want to talk about Grafana, a third-party open-source tool for data visualization that we will integrate with our Zabbix instance to build graphs using the data we already collected.
What are the benefits of Grafana? It provides better visualization and richer functionality than the graph widget in Zabbix 4.0, for instance.
You can get Grafana at grafana.com. As for the tools I’m going to use, I have CentOS 7 virtual machine with Zabbix 4.0.2, MariaDB, and Apache.
Grafana integration
Installation
Installing Grafana is simple. You can either download it from the official page or run it in the cloud.
Today I am going to explain how to configure Grafana on your machine, so I choose the download option. Grafana can run on Linux, Mac, Windows, etc., so simply select the right installation option for the platform you use and follow the instructions.
Getting started
Grafana, just like the Zabbix front end, is a web-based utility running on the local web engine. So once Grafana starts running with the default settings, we can go back to the browser to open the login page:
Note.3000 is the default HTTP port that Grafana listens to.
The default user credentials are admin/admin. When you log in for the first time you will be asked to change your password.
Once we are inside the Grafana home dashboard, we first need to add a data source before we can proceed with our first dashboard.
In Configuration>Data Sources you can choose from a variety of data sources from which to pull in the data and visualize it inside Grafana. What we need is a data source plugin to work through Zabbix API. Search the web for the official Zabbix plugin for Grafana by Alexander Zobnin or go to Configuration>Plugins>Zabbix.
Click on the Installation tab for instructions.
First, use grafana-cli, which is already available on your virtual machine after the installation of the Grafana server:
The plugin will be installed.
Then you need to restart the Grafana server for the changes to take effect:
Also, refresh the data source page. Go to Configuration>Plugins to enable our newly installed Zabbix data source:
With the plugin installed, we can log in to Grafana and configure it to talk to Zabbix.
Adding a data source
- Click on the cog on the side menu and go to Data Sources.
- Click Add data source.
- Select Zabbix.
- Check Default so this data source will be preselected in new dashboards.
- Enter URL:
5. Set Access to ‘Server (Default)‘.
6. Specify your username and password in Zabbix API details.
6. Specify your username and password in Zabbix API details.
7. Press Save & Test.
Creating a dashboard
Now we are going to create our first dashboard by pressing the plus on the sidebar and clicking Create>Dashboards.
Creating a new dashboard
Inside the dashboard, you can choose from a variety of panels.
Panels
Let’s say we need a graph. New graphs can be added by clicking on the icon and going to Panel Title>Edit.
Configure the metrics like this, then save the dashboard:
Graph metrics
To add another graph, simply repeat the previous steps. Existing graphs can also be duplicated or removed via Panel Title. You can drag-and-drop panels by clicking and holding the panel title and dragging it to a new location.
Other panel types can be configured similarly, for example, singlestat panels. You can use value mapping for singlestat panels to translate the value of the summary stat into explicit text.
Grafana Source
Singlestat value mapping
Note. The value-to-text mapping function helps to translate the number of the main singlestat value into a context-specific user-readable text.
We can also change the time range to make our panels more illustrative at the dashboard level and the panel level. For example, I change the time range to ‘Today‘:
Download Grafana Windows
Time range
Conclusion
As you can see, the Grafana possibilities are pretty huge. You can also download plugins, additional panels, etc. from the official Grafana Labs.
Pretty much everything inside Grafana can be edited. Visualization can be customized, which lets you create beautiful graphs. You can also add new users and restrict permissions.
Note.When specifying a user name for a data source, remember that permissions assigned in the front end also apply to the API. In my case, it is superadmin that can see everything and gather all the values from Zabbix.
Download Grafana Dashboard
So that’s about it. You now know how to install and configure Grafana. I’ll see you later, stay tuned.