Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to connect Java to Grafana

I really like the capabilities of Grafana for graphing metrics over time and showing a nice dashboard. I'd like to use it to track CPU, Mem, etc throughout my deployment environment. I'd also like to use it to track some numbers from my Java programs. How can I connect Java to Grafana?

Grafana supports three different database solutions (graphite, influxdb, OpenTSDB). I am not using any of these at the moment. But influxdb looks easy to setup. I'm really just looking for something simple and future-proof. It will only monitor a few servers for now, but it may grow in time. Is there an easy way to push a single Java integer with a label and timestamp into Grafana. I'm thinking there must be something like log4j for metrics. But I also need to decide which database to use, but hopefully that would be abstracted out of the interface. Any advice?

like image 291
user3923124 Avatar asked Jan 13 '15 15:01

user3923124


1 Answers

Grafana is 'just' a tool to display time series. Which means you will need an additional time series database between your java apllication and grafana.

You can find the current list of supported databases on their offical website: Datasources

As you mentioned influxdb, you might want to have a look at this influxdb-java project

like image 121
IIIIIIIIIIIIIIIIIIIIII Avatar answered Sep 23 '22 08:09

IIIIIIIIIIIIIIIIIIIIII