Grafana Endpoints API
The /endpoints/grafana endpoint manages the configured Grafana endpoints (used, for example, by the Grafana box report). It is mounted under /opennms/rest/endpoints/grafana and uses application/json. All operations require ROLE_REST or ROLE_ADMIN.
A Grafana endpoint is represented by the GrafanaEndpoint model:
-
id(Long): server-assigned database ID (not required on create). -
uid(String, required, unique): external unique identifier used by/verifyand the dashboard endpoints. -
url(String, required): base URL of the Grafana instance. -
apiKey(String, required): Grafana API key. -
description(String, optional) -
connectTimeout(Integer, optional): connection timeout in milliseconds. -
readTimeout(Integer, optional): read timeout in milliseconds.
GETs (reading data)
| Resource | Description |
|---|---|
|
Lists all configured Grafana endpoints. Returns |
|
Fetches a single Grafana endpoint by its numeric ID. |
|
Lists all dashboards available from the Grafana endpoint identified by |
|
Fetches a single dashboard by |
POSTs (Creating Data)
POST consumes application/json.
| Resource | Description |
|---|---|
|
Creates a new Grafana endpoint. Returns |
|
Verifies connectivity to a Grafana endpoint. Uses the existing |
PUT (modifying data)
PUT consumes application/json.
| Resource | Description |
|---|---|
|
Updates an existing Grafana endpoint (the endpoint is identified by the |
DELETEs (Removing Data)
| Resource | Description |
|---|---|
|
Deletes all configured Grafana endpoints. Returns |
|
Deletes a single Grafana endpoint by ID. Returns |
Examples using cURL
curl -u admin:admin "http://127.0.0.1:8980/opennms/rest/endpoints/grafana"
[{"id":1,"uid":"grafana-1","url":"http://grafana:3000","description":"Primary Grafana"}]
curl -u admin:admin -H 'Content-Type: application/json' \
-d '{"uid":"grafana-1","url":"http://grafana:3000","apiKey":"eyJrIjoi...","connectTimeout":5000,"readTimeout":30000}' \
"http://127.0.0.1:8980/opennms/rest/endpoints/grafana"
curl -u admin:admin -H 'Content-Type: application/json' \
-d '{"url":"http://grafana:3000","apiKey":"eyJrIjoi..."}' \
"http://127.0.0.1:8980/opennms/rest/endpoints/grafana/verify"
curl -u admin:admin "http://127.0.0.1:8980/opennms/rest/endpoints/grafana/grafana-1/dashboards"