Display 0 on query error

Hi guys,

I am using a json data source and when the server does not respond (Query error) for whatever reason the panel does not display the server. I am want the panel to display the server with a default value of 0 when the query fails (query error), how can I achieve that?

Panel json below:

{
“id”: 267,
“gridPos”: {
“h”: 8,
“w”: 24,
“x”: 0,
“y”: 36
},
“type”: “bargauge”,
“title”: “Storage Status - Capacity(Size TB)”,
“transformations”: ,
“datasource”: {
“uid”: “-- Mixed --”,
“type”: “datasource”
},
“pluginVersion”: “9.3.2”,
“fieldConfig”: {
“defaults”: {
“mappings”: ,
“thresholds”: {
“mode”: “percentage”,
“steps”: [
{
“color”: “green”,
“value”: null
},
{
“color”: “red”,
“value”: “”
}
]
},
“color”: {
“mode”: “continuous-GrYlRd”
},
“max”: 10000000000000,
“noValue”: “0”,
“unit”: “decbytes”
},
“overrides”: [
},
“options”: {
“reduceOptions”: {
“values”: false,
“calcs”: [
“lastNotNull”
],
“fields”: “”
},
“orientation”: “horizontal”,
“displayMode”: “lcd”,
“showUnfilled”: true,
“minVizWidth”: 0,
“minVizHeight”: 10
},
“targets”: [

{
  "datasource": {
    "type": "marcusolsson-json-datasource",
    "uid": "AJUC4SlVz"
  },
  "cacheDurationSeconds": 300,
  "fields": [
    {
      "jsonPath": "totalSize",
      "language": "jsonpath",
      "name": " ",
      "type": "number"
    }
  ],
  "hide": false,
  "method": "GET",
  "queryParams": "",
  "refId": "kalpakci",
  "urlPath": "/storage/api/v1/state/data"
}

],
“transparent”: true
}

Welcome @yasiryagi

Do you want this 0 to be displayed only when there is Query error. Is that the actual error returned: Query error

Or do you also want it for all other possible errors?

Yes, I want to handle the query error and display 0 when query error happens.

Here is the out put of the error

1 Like

Gotcha. What does the error tab look like when successful

No error tab when successful !!