9.1 Configuring Grafana

Indeni Integration with Grafana JSON API Datasource

This integration uses the JSON API Datasource to execute queries against the Indeni server. JSON API is an open source data source plugin for Grafana. This plugin is available natively in Grafana release 8.0.0 or later. If you are using an older version of Grafana, you can install the plugin in your local Grafana instance. For more information, visit the JSON API plugin installation page. 

Indeni API, based on HTTPS requests and JSON responses, uses API Key for authorization. API key is the token that the JSON API plugin provides when making API calls to the Indeni server. The key will be sent as a request header for every query. 

Configuration

Step 1: Install Grafana

Setup Grafana if you have not already. The Grafana website has detailed instructions here. Although you can install Grafana on the same server as Indeni, it is recommended that you install Grafana on a different server. 

Step 2: Obtain the API Key from Indeni

From your Indeni server, obtain the API Key using the Web UI under Settings > About. Copy the API Key. 

Step 3: Configure Grafana JSON API Datasource

  1. From your Grafana homepage, go to /datasources. Or click on the gear on the left pane, Configuration > Data sources. Click Add data sources
  2. Enter JSON in the search box to look for the JSON API plugin. 

If the JSON API plugin is not found, click on the gear on the left pane, Configuration > Plugins. Enter “JSON” in the search box, select “JSON API” and hit Install to install the plugin. Once the plugin is installed, click Create a JSON API data source

Please Note: If you’re using Grafana Cloud, you need to install the JSON API plugin. Go to Configuration > Plugins. Search for “JSON API”.

  1. If you are using a self-signed certificate with Indeni, enable With CA Cert and enter the certificate informati

The sample dashboards assume a datasource named “Indeni-APIv2”. 

Enter the Indeni API endpoint in the URL field (https://<Indeni-ip-addr>:9443/api/v2). That’s where Grafana datasource will make requests to. 

Please Note: If you’re using Grafana Cloud, do not use port 9443. Instead enter https://<Indeni-ip-addr>/api/v2.

  1. If you are using a self-signed certificate with Indeni, enable With CA Cert and enter the certificate information in text format in the TLS/SSL Auth Details box.
  1. Enable SKIP TLS Verify for Self-Signed certificates. If enabled, the server’s certificate will not be checked for validity. 
  1. Next, add Custom HTTP Headers by clicking the + Add header box. 
  1. Enter “X-API-Key” in the Header field, paste the API Key from Step 2 in the Value field. 
  1. Click the + Add header box to add another custom HTTP header. Enter “accept” in the Header field, then “application/json” in the Value field. 
  1. Click Save & test.

This completes the setup for JSON API Datasource. You can now start sending queries to the Indeni server. 

Please Note: Ignore the “JSON API:Not Found” message. Instead, follow the “Testing your Configuration” instructions below to test your configuration. 

Please Note: We recommend that you use Grafana Enterprise and enable query caching to minimize the impact to the Indeni server. We don’t recommend that you set the auto refresh to less than 5 minutes. 


Testing your Configuration

You can run a simple query to test your configuration. Select Explore from the left pane. Select “JSON API” as the datasource. Enter “$.tags.$string()” and select JSONata as shown below.

Click the Path field and enter the query “/devices” as shown below. 

The query should return a response similar to the above.