Pankaj Singhal
Pankaj Singhal

Reputation: 16053

Copy graphite dashboard to another graphite dashboard

I have a production graphite dashboard. I've saved some graphs under the tag abc so that you can access it using http://prod-graphite.com/dashboard/abc.

I've another dashboard for staging hosted on different server. Let's say the URL is http://staging-graphite.com/dashboard/.

I want to copy all the graphs of prod /abc to staging as I don't want to go through the trouble of creating 20 graphs again. I've tried the Copy Dashboard feature provided by graphite but it is not working. Nothing happens when I enter the prod URL. any help?

Upvotes: 3

Views: 644

Answers (1)

kwarunek
kwarunek

Reputation: 12577

GET/POST http://your.graphite.host/dashboard/load/YOUR_DASHBOARD_NAME - gives you dump of specified dashboard. It returns json with state as root object, that holds dashboards' structure.

POST http://your.graphite.host/dashboard/save/NEW_DASHBOARD_NAME - lets you save data as new dashboard. Requires state parameter with dashboards' structure.

Oneliner, fetchs dump, prepares body, save:

curl -o- http://graphite.host/dashboard/load/DASH_NAME | \
python -c "import json,sys,urllib;o=json.load(sys.stdin);print('state=%s' % urllib.quote(json.dumps(o['state'])));" | \
curl -X POST http://graphite.host/dashboard/save/COPY_OF_DASH_NAME -d @-

Upvotes: 5

Related Questions