How to connect Java to Grafana
I really love Grafana's ability to graphically display metrics over time and display a nice dashboard. I would like to use it to track CPU, Mem, etc. In my deployment environment. I would also like to use it to keep track of some numbers from my Java programs. How can I connect Java to Grafana?
Grafana supports three different database solutions (graphite, inflow, OpenTSDB). I am not using any of them at the moment. But influxdb looks very customizable. I'm just looking for something simple and secure in the future. At the moment it will only control a few servers, but it may grow over time. Is there an easy way to push a single Java integer with a timestamp and timestamp in Grafana. I think there should be something like log4j for metrics. But I also need to decide which database to use, but hopefully this will be abstracted from the interface. Any advice?
source to share
Grafana is just a tool for displaying time series. This means that you will need an additional time series database between your java application and grafana.
You can find the current list of supported databases on their official website: Data Sources
As you mentioned Infuxdb, you can take a look at this influxdb-java project
source to share
For monitoring with Grafana, I recommend Prometheus ( https://prometheus.io/docs/prometheus/latest/getting_started/ ) with a JMX exporter in your case: https://github.com/prometheus/jmx_exporter .
You can add more exporters if you need ( https://prometheus.io/docs/instrumenting/exporters/ ), you can expose your application metrics to Prometheus, etc.
Prometheus is a fully integrated monitoring solution, only charts are limited because you cannot create dashboards, but for that you have Grafana :)
source to share