17

I'm trying to figure out a way to create a data-source plugin which can communicate with an external REST API and provide relevant data to draw a panel.

Anyone with previous experience?

udarakr
  • 536
  • 2
  • 6
  • 18
  • 1
    As per now I went through one existing datasource to understand this. But unable to find any documentation on this. – udarakr Sep 21 '16 at 09:51
  • Have you finished your data source plugin? – kensai May 05 '19 at 10:40
  • I had the same issue, and found the JSON plugin too fiddly. So I created a trully REST plugin you might want to have a look at; https://github.com/Pithikos/rest-datasource – Pithikos Jun 24 '20 at 12:52

2 Answers2

13

The Simple JSON Datasource does roughly what you're proposing, and would definitely be a good base for you to start from.

There is also documentation on datasource plugins available.

tgogos
  • 23,218
  • 20
  • 96
  • 128
AussieDan
  • 2,116
  • 15
  • 11
  • I find the [strava-datasource](https://github.com/grafana/strava-datasource) a much better starting point since it show how to make the backend part of a plugin as well (If you want to do auth for example) – David Karlsson Apr 22 '20 at 13:55
  • Does it only support STRAVA Official Api? Can we use it to monitor our own APIs? – Pradyum Gupta Nov 04 '20 at 14:17
4

You can use Grafana Infinity datasource for connecting to REST API endpoints.

This plugin can connect to any REST API and present the data to grafana. You can use CSV,JSON and GraphQL endpoints. Documentation site have more examples on how to connect with external APIs

Note: I am the author of the plugin. If you see any bugs in the datasource, report it at github site.

Sriram
  • 767
  • 2
  • 17
  • 42