/sqlMetricsPusher

Sample Java code that creates dummy SQL metrics in an InfluxDB for viewing in Grafana.

Primary LanguageJavaApache License 2.0Apache-2.0

sqlMetricsPusher

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.

Instructions

  1. Install and start InfluxDB on localhost.

  2. 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"
  1. Install and start Grafana using these instructions.

  2. Open Grafana in a browser (http://localhost:3000).

  3. Configure Grafana to connect to the above InfluxDB, using these instructions.

  4. Use these instructions to import the dasboard in json format into Grafana.

Dashboard