Chronograf Dashboard Definitions

Originally published at: Chronograf Dashboard Definitions | InfluxData

If you have used Chronograf, you have seen how easy it is to create graphs and dashboards. And in fact your colleagues have probably come over to your laptop to marvel at the awesomeness of your dashboards and asked you how they too can share in the awesomeness of your Chronograf dashboard. And maybe your answer was “wow I don’t know how to share my awesome dashboard with you.” Well, worry no more. In this article, I am going to show you how to download your dashboard and how others can upload your dashboard to their instance of Chronograf.

In talking to customers, a common question I get is what sort of things should we be looking at when monitoring our InfluxEnterprise cluster? Our fantastic support team probably hears that question more than they care to. So they have created a list of common queries that will help monitor and troubleshoot your cluster. I have listed those queries at the bottom of this article. In addition to the queries, it would be great to have a dashboard that was always running these queries.

So I have created my dashboard, I’m happy and it looks great:

So how do you get a copy of my dashboard? Well, Chronograf has a great REST API. If you want to take a look at what’s available, just go to: http://[chronoserver]:8888/docs In order to get the dashboard, there are a few steps to follow:

First, find the id of the dashboard.

To do this, you will have to list out all the dashboards and find the id of the dashboard in question. (I know this is not ideal, and we are looking to make this easier.) To do that, you will have to make a GET request to: http://[chronoserver]:8888/chronograf/v1/dashboards This will return a JSON array of all the dashboard definitions you have:

    "dashboards": [
            "id": 2,
            "cells": [ … cell definitions …],
            "templates": [],
            "name": "My Awesome Dashboard",
            "links": {
                "self": "/chronograf/v1/dashboards/2",
                "cells": "/chronograf/v1/dashboards/2/cells",
                "templates": "/chronograf/v1/dashboards/2/templates"
            "id": 3,
            "cells": ["cells": [ … cell definitions …],
            "templates": [],
            "name": "InfluxDB Monitor",
            "links": {
                "self": "/chronograf/v1/dashboards/3",
                "cells": "/chronograf/v1/dashboards/3/cells",
                "templates": "/chronograf/v1/dashboards/3/templates"

In this case, I can see that “My Awesome Dashboard” has the id of ‘2’. Now let’s get the dashboard. You could either select and copy from the above output, but I have found that is sometimes error-prone and we don’t want to spend time debugging our JSON for missing curly brace. The JSON for our dashboard in this case would be available at: http://[chronoserver]:8888/chronograf/v1/dashboards/2 You can either paste the URL into browser and save the JSON or form the command line:

$ curl -i -X GET http://localhost:8888/chronograf/v1/dashboards/2 > MyAwesomeDashboard.json

Now send that file to your buddy. When they get it, they can upload it to their Chronograf server with the following from command line:

$ curl -i -X POST -H "Content-Type: application/json" \
http://[chronoserver]:8888/chronograf/v1/dashboards \
-d @/path/to/MyAwesomeDashboard.json

And voila. Now your buddy has a copy of your dashboard to use. Simple, quick and easy. Now go write some code.

1 Like

Where are the queries mentioned?

This is a really useful article, since I have a dashboards that I’ve built for one cluster that I’d like to replicate on another cluster in a completely separate environment.

However, this will work a lot better if you don’t include the headers with your curl command, so drop the -i,

curl -X GET http://localhost:8888/chronograf/v1/dashboards/3 > MyAwesomeDashboard.json.

As written the example includes headers in the saved file which will throw an error when you try to POST it:

{"code":400,"message":"Unparsable JSON"}

The article says:

Then it goes on to suggest using the URL ending in 3:

Is that a typo?

Looks like a typo to me. I’ve edited the previous post.

Hi all,
someone has been able to use the chronograf api with authentication process active: Managing Chronograf security | Chronograf 1.7 Documentation

Eg. I am trying to use them with keycloak configured, but I always receive the response:
HTTP/1.1 403 Forbidden

I know this is an old topic, but I’m looking for some help on this issue. Is there currently a way to use the chronograf REST API from a script after configuring it to use OAUTH 2.0? I would like to be able to deploy custom dashboards to chronograf via a script, e.g. using curl, as illustrated in this article. Should I conclude that this is no longer supported?

Hello @chad,
I recommend taking a look at templates. "With InfluxDB 2.0 we added the ability to export a configuration of your entire stack, and import it again into another instance of InfluxDB. This includes your InfluxDB buckets, dashboards, queries, alerts and even Telegraf configurations.

Since many people have the same or similar use cases, we wanted to provide a way for you to share your configurations with other users, and work together to enhance and improve them over time, just like you would any other open source project. So we’re launching a Community InfluxDB Templates project where you can publish your templates, see what other InfluxDB users have built, and try their templates yourself!"

You can also create and consume templates with the API.