1

I want to deployment dahsboards in chronograf.

curl -i -X GET http://192.168.85.79:8888/chronograf/v1/dashboards/ > mydashboard.json

curl -X POST -H "Content-Type: application/json" \ http://192.168.85.168:8888/chronograf/v1/dashboards \ -d @/mydashboard.json

response: HTTP/1.1 400 Bad Request Content-Type: application/json X-Chronograf-Version: 1.7.8 Date: Tue, 16 Apr 2019 15:08:01 GMT Content-Length: 40

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

Miguel Soares
  • 65
  • 1
  • 2
  • 7

2 Answers2

1

I found that the JSON that is downloaded via the API using the method above, writes the HTTP transaction data from cURL as well to the top of the file.

HTTP/1.1 200 OK
Server: nginx
Date: Tue, 10 Dec 2019 09:10:42 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Accept-Encoding
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, OPTIONS
Access-Control-Allow-Headers: origin, authorization, accept

You will need to remove that in order to get valid JSON to POST back to the API.

paulscott56
  • 496
  • 4
  • 7
0

You've probably moved on, but for the benefits of others:

From what I can see, your post curl command is invalid because you're prefacing your filename with a forward slash. Either remove it or prefix it with a . to mean "current directory"

However, from my own tests I don't think that this will work. You'd be better off using the export/import functionality built in Chronograf:

enter image description here

I've been looking at a way to automate this when provisioning Chronograf (through a Docker container in my case). If/when I figure it out I'll update this

kuzyn
  • 1,905
  • 18
  • 30