Create a table with same information for each input

  • What Grafana version and what operating system are you using?
    Debian 11, Grafana v9.3.2, Influx v2.6.1

  • What are you trying to achieve?
    Create a table panel with information like disk size, states for each disk on the system like this:

Disk name Capacity Status
disk1 500 Ok
disk2 1000 Pre-failed
  • How are you trying to achieve it?
    Information are gathered using telegraf with a configuration like this. Finally, information are stored like that:
    image

  • What happened?
    The best I have is this
    image

  • What did you expect to happen?
    A row for each disk containing capacity, state…

  • Can you copy/paste the configuration(s) that you are having problems with?

{
  "id": 30,
  "gridPos": {
    "h": 12,
    "w": 8,
    "x": 0,
    "y": 23
  },
  "type": "table",
  "title": "Physical Disk Status",
  "transformations": [
    {
      "id": "labelsToFields",
      "options": {
        "mode": "columns",
        "keepLabels": [
          "disks-name"
        ]
      }
    },
    {
      "id": "joinByField",
      "options": {
        "byField": "disks-name",
        "mode": "outer"
      }
    }
  ],
  "datasource": {
    "uid": "000000003",
    "type": "influxdb"
  },
  "pluginVersion": "9.3.2",
  "fieldConfig": {
    "defaults": {
      "custom": {
        "align": "center",
        "displayMode": "color-background-solid",
        "inspect": false,
        "filterable": true
      },
      "mappings": [],
      "thresholds": {
        "mode": "absolute",
        "steps": [
          {
            "color": "green",
            "value": null
          },
          {
            "color": "red",
            "value": 80
          }
        ]
      },
      "color": {
        "fixedColor": "transparent",
        "mode": "fixed"
      }
    },
    "overrides": []
  },
  "options": {
    "showHeader": true,
    "footer": {
      "show": false,
      "reducer": [
        "sum"
      ],
      "fields": "",
      "enablePagination": false
    },
    "frameIndex": 2,
    "sortBy": [
      {
        "displayName": "_value {_field=\"disks-capacity\", _start=\"2023-01-05 11:37:20.937 +0000 UTC\", _stop=\"2023-01-05 11:42:20.937 +0000 UTC\", agent_host=\"192.168.33.10\", disks-name=\"Physical Disk 0:1:6\", host=\"influx\", system-name=\"idrac-57M3H92\"}",
        "desc": true
      }
    ]
  },
  "targets": [
    {
      "datasource": {
        "uid": "000000003",
        "type": "influxdb"
      },
      "refId": "B",
      "hide": true,
      "query": "from(bucket: v.bucket) \n  |> range(start: v.timeRangeStart, stop:v.timeRangeStop)\n  |> filter(fn: (r) =>\n    r._measurement == \"idrac-hosts\" and\n    r[\"system-name\"] == \"${host}\" and\n    r._field == \"disks-name\"\n  )\n  |> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)"
    },
    {
      "datasource": {
        "uid": "000000003",
        "type": "influxdb"
      },
      "refId": "C",
      "hide": false,
      "query": "from(bucket: v.bucket) \n  |> range(start: v.timeRangeStart, stop:v.timeRangeStop)\n  |> filter(fn: (r) =>\n    r._measurement == \"idrac-hosts\" and\n    r[\"system-name\"] == \"${host}\" and\n    r._field == \"disks-capacity\"\n  )\n  |> last()\n"
    },
    {
      "datasource": {
        "uid": "000000003",
        "type": "influxdb"
      },
      "refId": "D",
      "hide": true,
      "query": "from(bucket: v.bucket) \n  |> range(start: v.timeRangeStart, stop:v.timeRangeStop)\n  |> filter(fn: (r) =>\n    r._measurement == \"idrac-hosts\" and\n    r[\"system-name\"] == \"${host}\" and\n    r._field == \"disks-state\"\n  )\n  |> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)\n  |> keyValues(keyColumns: [\"disks-name\"])"
    },
    {
      "datasource": {
        "uid": "000000003",
        "type": "influxdb"
      },
      "refId": "E",
      "hide": true,
      "query": "from(bucket: v.bucket) \n  |> range(start: v.timeRangeStart, stop:v.timeRangeStop)\n  |> filter(fn: (r) =>\n    r._measurement == \"idrac-hosts\" and\n    r[\"system-name\"] == \"${host}\" and\n    r._field == \"disks-predictivefail\"\n  )\n  |> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: false)"
    }
  ],
  "description": ""
}
  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

nothing

  • Did you follow any online instructions? If so, what is the URL?

I can only paste one other so, I’d say this one:

Thanks!

I finally ended up by finding that group() was what I needed :slight_smile:

1 Like