public class GrafanaClient
extends java.lang.Object
| Constructor and Description |
|---|
GrafanaClient(GrafanaConfiguration configuration) |
GrafanaClient(GrafanaConfiguration configuration,
okhttp3.OkHttpClient client)
Allows for the user to provide an OkHttpClient that can be used to connect to the Grafana
service.
|
| Modifier and Type | Method and Description |
|---|---|
DashboardMeta |
createDashboard(GrafanaDashboard grafanaDashboard)
Creates a Grafana dashboard.
|
AlertNotification |
createNotification(AlertNotification alertNotification)
Creates a Grafana alert notification.
|
java.lang.String |
deleteDashboard(java.lang.String dashboardName)
Deletes Grafana dashboard by name.
|
java.lang.String |
deleteNotification(java.lang.Integer id)
Deletes Grafana notification by id.
|
DashboardPanelAlert |
getAlert(java.lang.Integer id)
Searches for a Grafana alert with a given id.
|
GrafanaDashboard |
getDashboard(java.lang.String dashboardName)
Searches for an existing dashboard by name.
|
java.lang.String |
getHost() |
AlertNotification |
getNotification(java.lang.Integer id)
Searches for a Grafana notification with a given id.
|
java.util.List<AlertNotification> |
getNotifications()
Returns a list of all Grafana notifications.
|
java.util.List<GrafanaSearchResult> |
search(java.lang.String query,
java.lang.String tag,
java.lang.Boolean starred,
java.lang.Boolean tagcloud) |
DashboardMeta |
updateDashboard(GrafanaDashboard dashboard)
Updates a Grafana dashboard.
|
AlertNotification |
updateNotification(java.lang.Integer id,
AlertNotification alertNotification)
Updates a Grafana alert notification by id.
|
public GrafanaClient(GrafanaConfiguration configuration)
configuration - the information needed to communicate with Grafana.public GrafanaClient(GrafanaConfiguration configuration, okhttp3.OkHttpClient client)
Interceptor or other
specifics that are then used during communications with Grafanaconfiguration - the information needed to communicate with Grafana.client - An OkHttpClient that is used to connect to Grafanapublic java.lang.String getHost()
public GrafanaDashboard getDashboard(java.lang.String dashboardName) throws GrafanaDashboardDoesNotExistException, GrafanaException, java.io.IOException
dashboardName - the name of the dashboard to search for.GrafanaDashboard with matching name.GrafanaDashboardDoesNotExistException - if a dashboard with matching name does not exist.GrafanaException - if Grafana returns an error when trying to retrieve the dashboard.java.io.IOException - if a problem occurred talking to the server.public DashboardMeta createDashboard(GrafanaDashboard grafanaDashboard) throws GrafanaException, java.io.IOException
grafanaDashboard - the dashboard to be created.GrafanaException - if Grafana returns an error when trying to create the dashboard.java.io.IOException - if a problem occurred talking to the server.public DashboardMeta updateDashboard(GrafanaDashboard dashboard) throws GrafanaException, java.io.IOException
dashboard - the dashboard to be updated.GrafanaException - if Grafana returns an error when trying to create the dashboard.java.io.IOException - if a problem occurred talking to the server.public java.lang.String deleteDashboard(java.lang.String dashboardName)
throws GrafanaDashboardDoesNotExistException,
GrafanaDashboardCouldNotDeleteException,
java.io.IOException
dashboardName - the name of the dashboard to delete.GrafanaDashboardDoesNotExistException - if the dashboard does not existGrafanaDashboardCouldNotDeleteException - if Grafana returns an error when trying to
delete the dashboard.java.io.IOException - if a problem occurred talking to the server.public AlertNotification getNotification(java.lang.Integer id) throws GrafanaException, java.io.IOException
id - the id of the notification to search for.GrafanaException - if a notification with the given id does not exist.java.io.IOException - if a problem occurred talking to the server.public java.util.List<AlertNotification> getNotifications() throws GrafanaException, java.io.IOException
GrafanaException - if Grafana returns an unexpected error.java.io.IOException - if a problem occurred talking to the server.public AlertNotification createNotification(AlertNotification alertNotification) throws GrafanaException, java.io.IOException
alertNotification - the notification to be created.GrafanaException - if Grafana returns an error when trying to create the notification.java.io.IOException - if a problem occurred talking to the server.public AlertNotification updateNotification(java.lang.Integer id, AlertNotification alertNotification) throws GrafanaException, java.io.IOException
id - the id of the notification to be updated.alertNotification - the notification values to be updated.GrafanaException - if a notification does not exist for the given id.java.io.IOException - if a problem occurred talking to the server.public java.lang.String deleteNotification(java.lang.Integer id)
throws GrafanaException,
java.io.IOException
id - the id of the notification to delete.GrafanaException - if Grafana returns an error when trying to delete the notification.java.io.IOException - if a problem occurred talking to the server.public DashboardPanelAlert getAlert(java.lang.Integer id) throws GrafanaException, java.io.IOException
id - the id of the alert to search for.GrafanaException - if Grafana returns an error when trying to find the alert.java.io.IOException - if a problem occurred talking to the server.public java.util.List<GrafanaSearchResult> search(java.lang.String query, java.lang.String tag, java.lang.Boolean starred, java.lang.Boolean tagcloud) throws GrafanaException, java.io.IOException
GrafanaExceptionjava.io.IOException