Skip to content

Instantly share code, notes, and snippets.

@crisidev
Created October 7, 2015 20:35
Show Gist options
  • Save crisidev/bd52bdcc7f029be2f295 to your computer and use it in GitHub Desktop.
Save crisidev/bd52bdcc7f029be2f295 to your computer and use it in GitHub Desktop.
Command to export all grafana 2 dashboard to JSON using curl
KEY=XXXXXXXXXXXX
HOST="https://metrics.crisidev.org"
mkdir -p dashboards && for dash in $(curl -k -H "Authorization: Bearer $KEY" $HOST/api/search\?query\=\& |tr ']' '\n' |cut -d "," -f 5 |grep slug |cut -d\" -f 4); do
curl -k -H "Authorization: Bearer $KEY" $HOST/api/dashboards/db/$dash > dashboards/$dash.json
done
@saibug
Copy link

saibug commented Mar 15, 2024

.meta.folderTitle

it doesn't work wuth grafana v7.3.1 API :(

It's seems like folderUid doesn't exist in meta block ..

    "meta": {
        "type": "db",
        "canSave": true,
        "canEdit": true,
        "canAdmin": true,
        "canStar": true,
        "slug": "tcp-status",
        "url": "/d/YCaAbWJIk/tcp-status",
        "expires": "0001-01-01T00:00:00Z",
        "created": "2024-03-15T11:24:21+01:00",
        "updated": "2024-03-15T11:57:33+01:00",
        "updatedBy": "admin",
        "createdBy": "admin",
        "version": 3,
        "hasAcl": false,
        "isFolder": false,
        "folderId": 27,
        "folderTitle": "system",
        "folderUrl": "/dashboards/f/Oe6cfZ1Iz/system",
        "provisioned": false,
        "provisionedExternalId": ""
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment