Skip to content

hekonsek/grafana-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Grafana client for Java

Version Build

Grafana Java provides Java client for Grafana REST API.

Maven setup

<dependency>
  <groupId>com.github.hekonsek</groupId>
  <artifactId>grafana-java</artifactId>
  <version>0.1</version>
</dependency>

Usage

First of all create Grafana client instance:

Grafana grafana = new Grafana(new BasicAuthentication("admin", "admin"));

Then create dashboard you would like to save:

Dashboard dashboard = emptyDashboard(name);
Row row = rowWithGraph(name);
dashboard.getRows().add(row);
Graph graph = (Graph) dashboard.getRows().get(0).getPanels().get(0);
graph.getTargets().add(newGraphTarget(name, name));

And save it:

String dashboardId = grafana.saveDashboard(dashboard);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published