"message":"Failed to import dashboard" error while import grafana existing json file using HTTP API

sivanesan1

I am trying to import to grafana existing json file using HTTP API, it's reading the json file successfully but for each and every line, it's throwing command not found error.

I tried to execute the below command,

curl -X POST --insecure -H "Authorization: Bearer eyJrIjoiOWwwUmpQYUFmczhRVG1CZ1VmdTZ1VlZLTlc2ba0xUb0QiLCJuIjoia2xhIiwiaWQiOjJ9" -H "Content-Type: application/json" -d '{"dashboard":{"id": 1,"title": "tested33","tags": ["templated"],"timezone": "browser","rows": [{}],"schemaVersion": 6,"version": 0},"overwrite":false}' -d "$(/u04/my_metrics.json)"   localhost:3000/api/dashboards/db

It's reading each and every line in json file but throwing error

"message":"Failed to import dashboard"

{
  "annotations": {
  "list": [
   {
    "builtIn": 1,
    "datasource": "-- Grafana --",
    "enable": true,
    "hide": true,
    "iconColor": "rgba(0, 211, 255, 1)",
    "name": "Annotations & Alerts",
    "type": "dashboard"
  }
 ]
},
"editable": true,
"gnetId": 1860,
"graphTooltip": 0,
"id": 35,
"iteration": 1562652036142,
"links": [],
"panels": [
 {
  "collapsed": false,
  "gridPos": {
    "h": 1,
    "w": 24,
    "x": 0,
    "y": 0
  },
  "id": 261,
  "panels": [],
  "repeat": null,
  "title": "General",
  "type": "row"
},
{
  "cacheTimeout": null,
  "colorBackground": false,
  "colorValue": false,
  "colors": [
    "rgba(245, 54, 54, 0.9)",
    "rgba(237, 129, 40, 0.89)",
    "rgba(50, 172, 45, 0.97)"
  ],
  "datasource": "Prometheus",
  "decimals": 2,
  "description": "System Load (1m avg)",
  "format": "short",
  "gauge": {
    "maxValue": 100,
    "minValue": 0,
    "show": false,
    "thresholdLabels": false,
    "thresholdMarkers": true
  },
  "gridPos": {
    "h": 3,
    "w": 4,
    "x": 0,
    "y": 1
  },
  "id": 17,
  "interval": null,
  "links": [],
  "mappingType": 1,
  "mappingTypes": [
    {
      "name": "value to text",
      "value": 1
    },
    {
      "name": "range to text",
      "value": 2
    }
  ],
  "maxDataPoints": 100,
  "maxPerRow": 12,
  "nullPointMode": "null",
  "nullText": null,
  "options": {},
  "postfix": "",
  "postfixFontSize": "50%",
  "prefix": "",
  "prefixFontSize": "50%",
  "rangeMaps": [
    {
      "from": "null",
      "text": "N/A",
      "to": "null"
    }
  ],
  "sparkline": {
    "fillColor": "rgba(31, 118, 189, 0.18)",
    "full": false,
    "lineColor": "rgb(31, 120, 193)",
    "show": false
  },
  "tableColumn": "",
  "targets": [
    {
      "expr": "node_load1{instance=~\"$node:$port\",job=~\"$job\"}",
      "hide": false,
      "intervalFactor": 1,
      "refId": "A",
      "step": 900
    }
  ],
  "thresholds": "",
  "title": "System Load (1m avg)",
  "type": "singlestat",
  "valueFontSize": "50%",
  "valueMaps": [
    {
      "op": "=",
      "text": "N/A",
      "value": "null"
    }
  ],
  "valueName": "current"
}
],
"refresh": false,
"schemaVersion": 18,
"style": "dark",
"tags": [],
"templating": {
"list": [
  {
    "allValue": null,
    "current": {
      "text": "limca",
      "value": "limca"
    },
    "datasource": "Prometheus",
    "definition": "",
    "hide": 0,
    "includeAll": false,
    "label": "Job",
    "multi": false,
    "name": "job",
    "options": [],
    "query": "label_values(node_uname_info, job)",
    "refresh": 1,
    "regex": "",
    "skipUrlSync": false,
    "sort": 1,
    "tagValuesQuery": "",
    "tags": [],
    "tagsQuery": "",
    "type": "query",
    "useTags": false
  },
  {
    "allValue": null,
    "current": {
      "text": "limca",
      "value": "limca"
    },
    "datasource": "Prometheus",
    "definition": "",
    "hide": 2,
    "includeAll": false,
    "label": "",
    "multi": false,
    "name": "name",
    "options": [],
    "query": "label_values(node_uname_info{job=~\"$job\"}, nodename)",
    "refresh": 1,
    "regex": "",
    "skipUrlSync": false,
    "sort": 1,
    "tagValuesQuery": "",
    "tags": [],
    "tagsQuery": "",
    "type": "query",
    "useTags": false
  },
  {
    "allValue": null,
    "current": {
      "text": "limca",
      "value": "limca"
    },
    "datasource": "Prometheus",
    "definition": "",
    "hide": 2,
    "includeAll": false,
    "label": "Host:",
    "multi": false,
    "name": "node",
    "options": [],
    "query": "label_values(node_uname_info{nodename=\"$name\"}, instance)",
    "refresh": 1,
    "regex": "/([^:]+):.*/",
    "skipUrlSync": false,
    "sort": 1,
    "tagValuesQuery": "",
    "tags": [],
    "tagsQuery": "",
    "type": "query",
    "useTags": false
  },
  {
    "allValue": null,
    "current": {
      "text": "9100",
      "value": "9100"
    },
    "datasource": "Prometheus",
    "definition": "",
    "hide": 0,
    "includeAll": false,
    "label": "Port",
    "multi": false,
    "name": "port",
    "options": [],
    "query": "label_values(node_uname_info{instance=~\"$node:(.*)\"}, instance)",
    "refresh": 1,
    "regex": "/[^:]+:(.*)/",
    "skipUrlSync": false,
    "sort": 3,
    "tagValuesQuery": "",
    "tags": [],
    "tagsQuery": "",
    "type": "query",
    "useTags": false
  }
]
 },
 "time": {
"from": "now-24h",
"to": "now"
 },
 "timepicker": {
"refresh_intervals": [
  "5s",
  "10s",
  "30s",
  "1m",
  "5m",
  "15m",
  "30m",
  "1h",
  "2h",
  "1d"
],
"time_options": [
  "5m",
  "15m",
  "1h",
  "6h",
  "12h",
  "24h",
  "2d",
  "7d",
  "30d"
]
},
"timezone": "browser",
"title": "importTest",
"uid": "importjson",
"version": 1
}

Kindly review the json file once and assist me to resolve this issue

Jan Garaj

You are trying to import dashboard json /u04/my_metrics.json, which was exported in the Grafana UI. You have to use Grafana UI also for import - https://grafana.com/docs/reference/export_import/.

If you want to use Grafana dashboard API (https://grafana.com/docs/http_api/dashboard/), then you need to "export" (correct API name is "get dashboard") from Grafana API.

Grafana UI and Grafana dashboard API produce different dashboards JSON body schema, so you can't interchange them easily. In theory you convert json to correct format, but you need to be familiar with used dashboard JSON body schema.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Error message : Http not defined / API import Python

From Dev

Unable to import grafana json file via the grafana helm chart

From Java

Error while using the load class from Java to import property file

From Dev

Getting an file exists error while import into Hive using sqoop

From Dev

Import error while using pyshark

From Dev

HTTP Error 403: Forbidden while downloading file using urllib

From Dev

Add attachment to existing message using Javamail API

From Dev

R Error importing when import JSON file using the fromJSON function

From Dev

After updating existing cell value in .xlsx file using POI, the file is giving HTTP 403 if used by an API

From Dev

Import json file to object error

From Dev

error while reading json file using fs in Node js

From Dev

Error while reading json from pdf file using iText

From Dev

JSON error is coming while performing login using API in Ionic

From Dev

Json error coming while using roblox api in python

From Dev

Python error message when using import

From Dev

Error message while parsing json in Python

From Dev

Function not defined error while using import

From Dev

Error Message in If operator while using color code

From Dev

Getting error message while using Generic in typescript

From Dev

Getting Error Message while using tensorflow

From Dev

Error message while using inheritance in java

From Dev

REST API JSON error code and error message

From Dev

Connecting to crypto exchange api. Error while "sign & send" message using methods "POST" or "DELETE"?

From Dev

"error":true,"message":"required parameters are not available" while checking api call using postman

From Dev

Grafana overwrite existing dashboard via API

From Dev

Import JSON file without overwriting the existing data in Firebase

From Dev

Getting custom error message using fetch api when http response status is 400

From Dev

Saving an existing JSON file in Firebase using Swift?

From Dev

HTTP 406 Error While Logging In To DocuSign API

Related Related

  1. 1

    Error message : Http not defined / API import Python

  2. 2

    Unable to import grafana json file via the grafana helm chart

  3. 3

    Error while using the load class from Java to import property file

  4. 4

    Getting an file exists error while import into Hive using sqoop

  5. 5

    Import error while using pyshark

  6. 6

    HTTP Error 403: Forbidden while downloading file using urllib

  7. 7

    Add attachment to existing message using Javamail API

  8. 8

    R Error importing when import JSON file using the fromJSON function

  9. 9

    After updating existing cell value in .xlsx file using POI, the file is giving HTTP 403 if used by an API

  10. 10

    Import json file to object error

  11. 11

    error while reading json file using fs in Node js

  12. 12

    Error while reading json from pdf file using iText

  13. 13

    JSON error is coming while performing login using API in Ionic

  14. 14

    Json error coming while using roblox api in python

  15. 15

    Python error message when using import

  16. 16

    Error message while parsing json in Python

  17. 17

    Function not defined error while using import

  18. 18

    Error Message in If operator while using color code

  19. 19

    Getting error message while using Generic in typescript

  20. 20

    Getting Error Message while using tensorflow

  21. 21

    Error message while using inheritance in java

  22. 22

    REST API JSON error code and error message

  23. 23

    Connecting to crypto exchange api. Error while "sign & send" message using methods "POST" or "DELETE"?

  24. 24

    "error":true,"message":"required parameters are not available" while checking api call using postman

  25. 25

    Grafana overwrite existing dashboard via API

  26. 26

    Import JSON file without overwriting the existing data in Firebase

  27. 27

    Getting custom error message using fetch api when http response status is 400

  28. 28

    Saving an existing JSON file in Firebase using Swift?

  29. 29

    HTTP 406 Error While Logging In To DocuSign API

HotTag

Archive