Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Chronograf Dashboard Definitions

DZone's Guide to

Chronograf Dashboard Definitions

Your boss comes up to your laptop to marvel at the awesomeness of your Chronograf dashboard. She wants you to send it to her. But you don't know how! Worry no more.

· Database Zone
Free Resource

Read why times series is the fastest growing database category.

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 dashboard. But 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.

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 an ID of 2. Now, let's get the dashboard. You could 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 one missing curly brace. The JSON for our dashboard, in this case, would be available at http://[chronoserver]:8888/chronograf/v1/dashboards/3. You can either paste the URL into the browser and save the JSON, or form the command line:

$ curl -i -X GET http://localhost:8888/chronograf/v1/dashboards/3 > 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.

Learn how to get 20x more performance than Elastic by moving to a Time Series database.

Topics:
database ,rest api ,data visualization ,chronograf ,tutorial

Published at DZone with permission of Dave Patton, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}