Chronograf Dashboard Definitions
By
Dave Patton /
Product, Use Cases, Developer
Nov 07, 2017
Navigate to:
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 InfluxDB Enterprise 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.