1

I am currently exploring the best way to visualizing data from Carbonite Server Backup. They offer an simple Api that returns Json data. I want to visualize this data in Grafana. However the Api uses an annoying way of authentication.

I have to make an Api call to the server with grant_type, client_id and client_secret. This returns a Api token that is valid for 5 minutes. This token is used in the actual Api calls in for of an authorization header with the value like "Bearer TOKEN_HERE"

I stumbled upon this: https://grafana.com/docs/grafana/latest/developers/plugins/add-authentication-for-data-source-plugins/#enable-token-authentication

This looks exactly as I need it however this seems for the people that make datasource plugins. Is it possible to configure this route for any of the Json datasource plugins in Grafana?

Another possibility can be to use json_exporter for Prometheus to scrape the metrics first. However I can't find very detailed documents so i can't tell of its possible to such "Token Auth" using this exporter.

This is how I should be able to authenticate using either a datasource plugin for grafana or a scraper for Prometheus:

{ 
"path": "example", 
"url": "https://api.example.com", 
"tokenAuth": { 
  "url": "https://login.example.com/oauth2/token", 
  "params": { 
    "grant_type": "client_credentials", 
    "client_id": "{{ .JsonData.clientId }}", 
    "client_secret": "{{ .SecureJsonData.clientSecret }}" } 
  } 
}

Does anyone have experience with such authorization methods? How do I solve my problem?

0 Answers0