Skip to content

icinga2-default.json example Dashboard Import Fail #72

@SonenPHP

Description

@SonenPHP

I can't import the icinga2-default.json Dashboard into Grafana (v12.02).

The Import will not finish - this Grafana Error is logged: "dashboard import failed: missing dashboard input variable VAR_HOSTNAME"

I created a new one for myself before updated from Grafana 11 to 12.
I think the example(s) here are old, slow and in need of renewal.

My example for icinga2 influx default:

{
  "__inputs": [
    {
      "name": "DS_INFLUXDB",
      "label": "influxdb",
      "description": "",
      "type": "datasource",
      "pluginId": "influxdb",
      "pluginName": "InfluxDB"
    }
  ],
  "__elements": {},
  "__requires": [
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "12.0.0"
    },
    {
      "type": "datasource",
      "id": "influxdb",
      "name": "InfluxDB",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "timeseries",
      "name": "Time series",
      "version": ""
    }
  ],
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "grafana",
          "uid": "-- Grafana --"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": null,
  "links": [],
  "panels": [
    {
      "datasource": {
        "type": "influxdb",
        "uid": "${DS_INFLUXDB}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisBorderShow": false,
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "barWidthFactor": 0.6,
            "drawStyle": "line",
            "fillOpacity": 10,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "insertNulls": false,
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": true,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green"
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "short"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 0
      },
      "id": 1,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "hideZeros": false,
          "mode": "multi",
          "sort": "asc"
        }
      },
      "pluginVersion": "12.0.0",
      "targets": [
        {
          "alias": "$tag_metric",
          "dsType": "influxdb",
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "metric"
              ],
              "type": "tag"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "/^$command$/",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "from(bucket: \"icinga2\")\r\n  |> range(start: v.timeRangeStart, stop:v.timeRangeStop)\r\n  |> filter(fn: (r) =>\r\n    r._measurement == \"${command}\" and\r\n    r.service == \"${service}\" and\r\n    r._field == \"value\" and\r\n    r.hostname == \"${hostname}\"\r\n  )\r\n  |> map(fn: (r) => ({ _value:r._value, _time:r._time, _field: r.metric }))\r\n  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: true)",
          "rawQuery": true,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": [
            {
              "key": "hostname",
              "operator": "=~",
              "value": "/^$hostname$/"
            },
            {
              "condition": "AND",
              "key": "service",
              "operator": "=~",
              "value": "/^$service$/"
            }
          ],
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_INFLUXDB}"
          }
        }
      ],
      "title": "$service",
      "type": "timeseries"
    }
  ],
  "schemaVersion": 41,
  "tags": [],
  "templating": {
    "list": [
      {
        "current": {
          "text": "",
          "value": ""
        },
        "name": "hostname",
        "options": [],
        "query": "",
        "type": "custom"
      },
      {
        "current": {
          "text": "",
          "value": ""
        },
        "name": "service",
        "options": [],
        "query": "",
        "type": "custom"
      },
      {
        "current": {
          "text": "",
          "value": ""
        },
        "name": "command",
        "options": [],
        "query": "",
        "type": "custom"
      }
    ]
  },
  "time": {
    "from": "now-6h",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "browser",
  "title": "icinga2-default",
  "uid": "798f5950-d723-4f59-9d5c-c46898be89f3gg",
  "version": 3,
  "weekStart": ""
}```

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions