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.
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.
Please Note: If you’re using Grafana 10, by default, it comes installed with the JSON API plugin v1.3.6. This version is not supported. You must downgrade the JSON API plugin to v1.3.2.
To downgrade the JSON API plugin version from v1.3.6 to v1.3.2:
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
- From your Grafana homepage, go to /datasources. Or click on the gear on the left pane, Configuration > Data sources. Click Add data sources.
- 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”.
The Data Sources’ name must be “Indeni-APIv2” in order to be compatible with the sample dashboards.
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.
- 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.
- Enable SKIP TLS Verify for Self-Signed certificates. If enabled, the server’s certificate will not be checked for validity.
- Next, add Custom HTTP Headers by clicking the + Add header box.
- Enter “X-API-Key” in the Header field, paste the API Key from Step 2 in the Value field.
- Click the + Add header box to add another custom HTTP header. Enter “accept” in the Header field, then “application/json” in the Value field.
- Click Save & test.
Please Note: You will receive the “JSON API:Not Found” message after clicking the “Save & test” button. Ignore the message. Instead, follow the “Testing your Configuration” instructions below to test your configuration.
This completes the setup for JSON API Datasource. You can now start sending queries to the Indeni server.
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.