This repo contains sample code that creates metrics of dummy SQL statement executions. It INSERTs them into an InfluxDB for viewing in a Grafana dashboard.
The dashboard below shows response time and throughput of the dummy SQL metrics. Note the bar at the top for drilling down into the various machines/environments reporting metrics to this one InfluxDB server.
-
Install and start InfluxDB on localhost.
-
Run the SqlInfluxJava java program. It will create dummy metrics in the InfluxDB.
- Prerequisites: Maven and a JDK
- Download this zip file.
- To build the code, 'cd' to the same folder as the pom.xml file and type:
mvn clean package
* Run the program with this command:
*
mvn exec:java -Dexec.mainClass="com.github.eostermueller.sqlmetrics.SqlInfluxJava"
-
Install and start Grafana using these instructions.
-
Open Grafana in a browser (http://localhost:3000).
-
Configure Grafana to connect to the above InfluxDB, using these instructions.
-
Use these instructions to import the dasboard in json format into Grafana.