Display output(metrics) of a java program as graphs in Grafana

Grafana version 8 | Linux

We are having a java program running in a host which fetch the metrics from activemq using statisticsPluginData, so trying to display its output values as graph in a dashboard

Do we have any datasource which could run the code and display output
Could someone help to build the dashboard for the above requirement

Thank you

A plugin that runs the java code? Is this output value in a file or an http like response or a java command line response?

2 Likes

Its a Java command line response. Could you direct me to the document/web link where i can refer and construct the dashboard like the one you have posted

This is not using a java command line, just the results, – delimited data

Sorry i was answering your first question

β€œA plugin that runs the java code? Is this output value in a file or an http like response or a java command line response?”

1 Like

I do not have a command line java connected to my grafana dashboard. This is what I did. I saw the result of your command line data and used that as basis for a – delimited csv inline entry using infinity plugin to plot your data. I do not know of any plugin that calls a java cli.

1 Like

Hello @arjunasamy,

Have you tried with Telegraf ?
You could use this plugin called Execd to run the java program and capture its output. (bear in mind that this output needs to be in one of the supported formats for the plugin to recognize)
After that you could send it to a database to query from Grafana, or you could simply stream the data directly from Telegraf to Grafana without needing a database in between. (assuming you don’t need this data permanently).

Another possibility would be to use prometheus to scrape the data via an exposed endpoint using a compatible exporter: JMX exporter
I found a tutorial online which might help to fill in the gaps: Use Prometheus Monitoring With Java to Gather Data
You could then query prometheus with PromQL in order to visualize data in Grafana.

1 Like