Grafana dashboard: Macos GPU - Intel+AMD / Apple Silicon
Description: I would like to share a command line tool that can be used in conjunction with the macOS GPU Helper app to gather GPU information from Intel and Apple silicon-based Macs. This tool works together with telegraf to populate an Influxdb bucket, which is then used as a source for Grafana. For help configuring  this tool and to download the helper app, visit https://github.com/XReyRobert/macos-telegraf-gpumonitoring

I would like to share a command line tool that can be used in conjunction with the macOS GPU Helper app to gather GPU information from Intel and Apple silicon-based Macs. This tool works together with telegraf to populate an Influxdb bucket, which is then used as a source for Grafana. For help configuring  this tool and to download the helper app, visit https://github.com/XReyRobert/macos-telegraf-gpumonitoring

{
  "__inputs": [
    {
      "name": "DS_INFLUXDB",
      "label": "InfluxDB",
      "description": "",
      "type": "datasource",
      "pluginId": "influxdb",
      "pluginName": "InfluxDB"
    },
    {
      "name": "VAR_MYBUCKET",
      "type": "constant",
      "label": "mybucket",
      "value": "XRRMonitoring",
      "description": "enter your bucket name"
    }
  ],
  "__elements": {},
  "__requires": [
    {
      "type": "panel",
      "id": "gauge",
      "name": "Gauge",
      "version": ""
    },
    {
      "type": "grafana",
      "id": "grafana",
      "name": "Grafana",
      "version": "9.3.2"
    },
    {
      "type": "datasource",
      "id": "influxdb",
      "name": "InfluxDB",
      "version": "1.0.0"
    },
    {
      "type": "panel",
      "id": "text",
      "name": "Text",
      "version": ""
    },
    {
      "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",
        "target": {
          "limit": 100,
          "matchAny": false,
          "tags": [],
          "type": "dashboard"
        },
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": null,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "influxdb",
        "uid": "${DS_INFLUXDB}"
      },
      "gridPos": {
        "h": 4,
        "w": 23,
        "x": 0,
        "y": 0
      },
      "id": 32,
      "options": {
        "code": {
          "language": "plaintext",
          "showLineNumbers": false,
          "showMiniMap": false
        },
        "content": "<div style=\"font-size: 2em;\">\n  <p>You like it? You use it? It saved you a couple of hours?</p>\n  <p>Hey 👋 <a href=\"https://www.buymeacoffee.com/xrrxrr\">You can now buy me a coffee</a>! ☕️</p>\n</div>\n",
        "mode": "html"
      },
      "pluginVersion": "9.3.2",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_INFLUXDB}"
          },
          "refId": "A"
        }
      ],
      "transparent": true,
      "type": "text"
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 4
      },
      "id": 11,
      "panels": [],
      "title": "AppleSilicon - GPU",
      "type": "row"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "${DS_INFLUXDB}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "smooth",
            "lineWidth": 3,
            "pointSize": 3,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "%"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Device Utilization %"
            },
            "properties": [
              {
                "id": "custom.axisColorMode",
                "value": "series"
              },
              {
                "id": "displayName",
                "value": "Device Utilization"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Tiler Utilization %"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Tiler Utilisation"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Renderer Utilization %"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Renderer Utilization"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 5
      },
      "id": 13,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "9.3.2",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_INFLUXDB}"
          },
          "query": "from(bucket: \"${mybucket}\")\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |> filter(fn: (r) => r[\"host\"] == \"${host}\")\n  |> filter(fn: (r) => r[\"_measurement\"] == \"macosgpu\")\n  |> filter(fn: (r) => r[\"_field\"] == \"Renderer Utilization %\" or r[\"_field\"] == \"Tiler Utilization %\" or r[\"_field\"] == \"Device Utilization %\")\n  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n  |> yield(name: \"mean\")",
          "refId": "A"
        }
      ],
      "title": "Utilization",
      "transformations": [],
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "${DS_INFLUXDB}"
      },
      "description": "",
      "gridPos": {
        "h": 2,
        "w": 12,
        "x": 12,
        "y": 5
      },
      "id": 25,
      "options": {
        "code": {
          "language": "plaintext",
          "showLineNumbers": false,
          "showMiniMap": false
        },
        "content": "<div style=\"text-align:center; font-weight:bold; font-size:35px; background-color:#054ada; color:#ffffff;\">Apple Silicon</div>\n",
        "mode": "html"
      },
      "pluginVersion": "9.3.2",
      "targets": [
        {
          "columns": [],
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_INFLUXDB}"
          },
          "filters": [],
          "format": "table",
          "global_query_id": "",
          "query": "",
          "refId": "A",
          "root_selector": "",
          "source": "url",
          "type": "json",
          "url": "https://github.com/yesoreyeram/grafana-infinity-datasource/blob/main/testdata/users.json",
          "url_options": {
            "data": "",
            "method": "GET"
          }
        }
      ],
      "transparent": true,
      "type": "text"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "${DS_INFLUXDB}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "fixedColor": "blue",
            "mode": "fixed"
          },
          "mappings": [],
          "max": 100,
          "min": 0,
          "thresholds": {
            "mode": "percentage",
            "steps": [
              {
                "color": "blue",
                "value": null
              }
            ]
          },
          "unit": "percent"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 6,
        "w": 6,
        "x": 12,
        "y": 7
      },
      "id": 18,
      "options": {
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "/^Device Utilization % MacBookProM1\\-2\\.local$/",
          "values": false
        },
        "showThresholdLabels": false,
        "showThresholdMarkers": false
      },
      "pluginVersion": "9.3.2",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_INFLUXDB}"
          },
          "query": "from(bucket: \"${mybucket}\")\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |> filter(fn: (r) => r[\"host\"] == \"${host}\")\n  |> filter(fn: (r) => r[\"_measurement\"] == \"macosgpu\")\n  |> filter(fn: (r) => r[\"_field\"] == \"Device Utilization %\")\n  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n  |> yield(name: \"mean\")",
          "refId": "A"
        }
      ],
      "title": " GPU Utilization",
      "transformations": [
        {
          "id": "calculateField",
          "options": {
            "binary": {
              "left": "fb_memory_usage_used {gpuid=\"00000000:84:00.0\", host=\"proxmox\", name=\"nvidia-smi\"}",
              "operator": "/",
              "reducer": "sum",
              "right": "fb_memory_usage_total {gpuid=\"00000000:84:00.0\", host=\"proxmox\", name=\"nvidia-smi\"}"
            },
            "mode": "binary",
            "reduce": {
              "reducer": "sum"
            }
          }
        },
        {
          "id": "calculateField",
          "options": {
            "binary": {
              "left": "fb_memory_usage_used {gpuid=\"00000000:84:00.0\", host=\"proxmox\", name=\"nvidia-smi\"} / fb_memory_usage_total {gpuid=\"00000000:84:00.0\", host=\"proxmox\", name=\"nvidia-smi\"}",
              "operator": "*",
              "reducer": "sum",
              "right": "100"
            },
            "mode": "binary",
            "reduce": {
              "reducer": "sum"
            },
            "replaceFields": true
          }
        }
      ],
      "type": "gauge"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "${DS_INFLUXDB}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "fixedColor": "blue",
            "mode": "fixed"
          },
          "mappings": [],
          "min": 0,
          "thresholds": {
            "mode": "percentage",
            "steps": [
              {
                "color": "blue",
                "value": null
              }
            ]
          },
          "unit": "decgbytes"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 6,
        "w": 6,
        "x": 18,
        "y": 7
      },
      "id": 20,
      "options": {
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "/^In use system memory MacBookProM1\\-2\\.local / 1e9$/",
          "values": false
        },
        "showThresholdLabels": false,
        "showThresholdMarkers": false
      },
      "pluginVersion": "9.3.2",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_INFLUXDB}"
          },
          "query": "from(bucket: \"${mybucket}\")\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |> filter(fn: (r) => r[\"host\"] == \"${host}\")\n  |> filter(fn: (r) => r[\"_measurement\"] == \"macosgpu\")\n  |> filter(fn: (r) => r[\"_field\"] == \"In use system memory\")\n  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n  |> last()\n  ",
          "refId": "A"
        }
      ],
      "title": " Memory",
      "transformations": [
        {
          "id": "calculateField",
          "options": {
            "binary": {
              "left": "In use system memory MacBookProM1-2.local",
              "operator": "/",
              "reducer": "sum",
              "right": "1e9"
            },
            "mode": "binary",
            "reduce": {
              "reducer": "sum"
            },
            "replaceFields": false
          }
        }
      ],
      "type": "gauge"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "${DS_INFLUXDB}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "left",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "smooth",
            "lineWidth": 3,
            "pointSize": 3,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "decgbytes"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 13
      },
      "id": 16,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "9.3.2",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_INFLUXDB}"
          },
          "query": "from(bucket: \"${mybucket}\")\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |> filter(fn: (r) => r[\"host\"] == \"${host}\")\n  |> filter(fn: (r) => r[\"_measurement\"] == \"macosgpu\")\n  |> filter(fn: (r) => r[\"_field\"] == \"Alloc system memory\" or r[\"_field\"] == \"In use system memory\")\n  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n  |> yield(name: \"mean\")  ",
          "refId": "A"
        }
      ],
      "title": "Utilization",
      "transformations": [
        {
          "id": "calculateField",
          "options": {
            "binary": {
              "left": "Alloc system memory {host=\"MacBookProM1-2.local\", name=\"macosgpu\"}",
              "operator": "/",
              "reducer": "sum",
              "right": "1e9"
            },
            "mode": "binary",
            "reduce": {
              "reducer": "sum"
            },
            "replaceFields": false
          }
        },
        {
          "id": "calculateField",
          "options": {
            "binary": {
              "left": "In use system memory {host=\"MacBookProM1-2.local\", name=\"macosgpu\"}",
              "operator": "/",
              "reducer": "sum",
              "right": "1e9"
            },
            "mode": "binary",
            "reduce": {
              "reducer": "sum"
            },
            "replaceFields": false
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Alloc system memory {host=\"MacBookProM1-2.local\", name=\"MacosAppleSiliconGPU\"}": true,
              "Alloc system memory {host=\"MacBookProM1-2.local\", name=\"macosgpu\"}": true,
              "In use system memory {host=\"MacBookProM1-2.local\", name=\"MacosAppleSiliconGPU\"}": true,
              "In use system memory {host=\"MacBookProM1-2.local\", name=\"macosgpu\"}": true
            },
            "indexByName": {},
            "renameByName": {
              "Alloc system memory {host=\"MacBookProM1-2.local\", name=\"MacosAppleSiliconGPU\"}": "",
              "Alloc system memory {host=\"MacBookProM1-2.local\", name=\"MacosAppleSiliconGPU\"} / 1e-9": "Alloc system memory",
              "Alloc system memory {host=\"MacBookProM1-2.local\", name=\"macosgpu\"}": "",
              "Alloc system memory {host=\"MacBookProM1-2.local\", name=\"macosgpu\"} / 1e9": "Alloc system memory",
              "In use system memory {host=\"MacBookProM1-2.local\", name=\"MacosAppleSiliconGPU\"}": "",
              "In use system memory {host=\"MacBookProM1-2.local\", name=\"MacosAppleSiliconGPU\"} / 1e-9": "In use system memory",
              "In use system memory {host=\"MacBookProM1-2.local\", name=\"macosgpu\"}": "",
              "In use system memory {host=\"MacBookProM1-2.local\", name=\"macosgpu\"} / 1e9": "In use system memory"
            }
          }
        }
      ],
      "type": "timeseries"
    },
    {
      "collapsed": false,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 21
      },
      "id": 9,
      "panels": [],
      "title": "Intel - AMD",
      "type": "row"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "${DS_INFLUXDB}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "smooth",
            "lineWidth": 4,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "watt"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Total Power(W)"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Total Power"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 22
      },
      "id": 7,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "9.3.2",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_INFLUXDB}"
          },
          "query": "from(bucket: \"${mybucket}\")\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |> filter(fn: (r) => r[\"host\"] == \"${host}\")\n  |> filter(fn: (r) => r[\"_measurement\"] == \"macosgpu\")\n  |> filter(fn: (r) => r[\"host\"] == \"Mac-Pro.local\")\n  |> filter(fn: (r) => r[\"_field\"] == \"Total Power(W)\")\n  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n  |> yield(name: \"mean\")",
          "refId": "A"
        }
      ],
      "title": "Power",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "${DS_INFLUXDB}"
      },
      "description": "",
      "gridPos": {
        "h": 2,
        "w": 12,
        "x": 12,
        "y": 22
      },
      "id": 26,
      "options": {
        "code": {
          "language": "plaintext",
          "showLineNumbers": false,
          "showMiniMap": false
        },
        "content": "<div style=\"text-align:center; font-weight:bold; font-size:35px; background-color:#054ada; color:#ffffff;\">Intel Macos - AMD\n\n</div>\n",
        "mode": "html"
      },
      "pluginVersion": "9.3.2",
      "targets": [
        {
          "columns": [],
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_INFLUXDB}"
          },
          "filters": [],
          "format": "table",
          "global_query_id": "",
          "query": "",
          "refId": "A",
          "root_selector": "",
          "source": "url",
          "type": "json",
          "url": "https://github.com/yesoreyeram/grafana-infinity-datasource/blob/main/testdata/users.json",
          "url_options": {
            "data": "",
            "method": "GET"
          }
        }
      ],
      "transparent": true,
      "type": "text"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "${DS_INFLUXDB}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "fixedColor": "blue",
            "mode": "fixed"
          },
          "mappings": [],
          "max": 100,
          "min": 0,
          "thresholds": {
            "mode": "percentage",
            "steps": [
              {
                "color": "blue",
                "value": null
              }
            ]
          },
          "unit": "percent"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 6,
        "w": 6,
        "x": 12,
        "y": 24
      },
      "id": 22,
      "options": {
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "/^Device Utilization % Mac\\-Pro\\.local$/",
          "values": false
        },
        "showThresholdLabels": false,
        "showThresholdMarkers": false
      },
      "pluginVersion": "9.3.2",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_INFLUXDB}"
          },
          "query": "from(bucket: \"${mybucket}\")\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |> filter(fn: (r) => r[\"host\"] == \"${host}\")\n  |> filter(fn: (r) => r[\"_measurement\"] == \"macosgpu\")\n  |> filter(fn: (r) => r[\"_field\"] == \"Device Utilization %\")\n  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n  |> yield(name: \"mean\")",
          "refId": "A"
        }
      ],
      "title": " GPU Utilization",
      "transformations": [
        {
          "id": "calculateField",
          "options": {
            "binary": {
              "left": "fb_memory_usage_used {gpuid=\"00000000:84:00.0\", host=\"proxmox\", name=\"nvidia-smi\"}",
              "operator": "/",
              "reducer": "sum",
              "right": "fb_memory_usage_total {gpuid=\"00000000:84:00.0\", host=\"proxmox\", name=\"nvidia-smi\"}"
            },
            "mode": "binary",
            "reduce": {
              "reducer": "sum"
            }
          }
        },
        {
          "id": "calculateField",
          "options": {
            "binary": {
              "left": "fb_memory_usage_used {gpuid=\"00000000:84:00.0\", host=\"proxmox\", name=\"nvidia-smi\"} / fb_memory_usage_total {gpuid=\"00000000:84:00.0\", host=\"proxmox\", name=\"nvidia-smi\"}",
              "operator": "*",
              "reducer": "sum",
              "right": "100"
            },
            "mode": "binary",
            "reduce": {
              "reducer": "sum"
            },
            "replaceFields": true
          }
        }
      ],
      "type": "gauge"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "${DS_INFLUXDB}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "fixedColor": "blue",
            "mode": "fixed"
          },
          "mappings": [],
          "min": 0,
          "thresholds": {
            "mode": "percentage",
            "steps": [
              {
                "color": "blue",
                "value": null
              }
            ]
          },
          "unit": "decgbytes"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 6,
        "w": 6,
        "x": 18,
        "y": 24
      },
      "id": 23,
      "options": {
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "/^inUseVidMemoryBytes Mac\\-Pro\\.local / 1e9$/",
          "values": false
        },
        "showThresholdLabels": false,
        "showThresholdMarkers": false
      },
      "pluginVersion": "9.3.2",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_INFLUXDB}"
          },
          "query": "from(bucket: \"${mybucket}\")\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |> filter(fn: (r) => r[\"host\"] == \"${host}\")\n  |> filter(fn: (r) => r[\"host\"] == \"Mac-Pro.local\")\n  |> filter(fn: (r) => r[\"_measurement\"] == \"macosgpu\")\n  |> filter(fn: (r) => r[\"_field\"] == \"inUseVidMemoryBytes\")\n  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n  |> yield(name: \"mean\")",
          "refId": "A"
        }
      ],
      "title": " Memory",
      "transformations": [
        {
          "id": "calculateField",
          "options": {
            "binary": {
              "left": "inUseVidMemoryBytes Mac-Pro.local",
              "operator": "/",
              "reducer": "sum",
              "right": "1e9"
            },
            "mode": "binary",
            "reduce": {
              "reducer": "sum"
            },
            "replaceFields": false
          }
        }
      ],
      "type": "gauge"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "${DS_INFLUXDB}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "smooth",
            "lineWidth": 3,
            "pointSize": 3,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "MHz"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "clocks_graphics_clock"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "graphics"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Memory Clock(MHz)"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Memory Clock"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Core Clock(MHz)"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "Core Clock"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "clocks_video_clock"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "video"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 30
      },
      "id": 4,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "9.3.2",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_INFLUXDB}"
          },
          "query": "from(bucket: \"${mybucket}\")\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |> filter(fn: (r) => r[\"host\"] == \"${host}\")\n  |> filter(fn: (r) => r[\"_measurement\"] == \"macosgpu\")\n  |> filter(fn: (r) => r[\"_field\"] == \"Core Clock(MHz)\" or r[\"_field\"] == \"Memory Clock(MHz)\")\n  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n  |> yield(name: \"mean\")\n  ",
          "refId": "A"
        }
      ],
      "title": "Clocks",
      "transformations": [],
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "${DS_INFLUXDB}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "smooth",
            "lineWidth": 4,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "decgbytes"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "inUseVidMemoryBytes Mac-Pro.local"
            },
            "properties": [
              {
                "id": "displayName",
                "value": "in use video memory"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 30
      },
      "id": 21,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "9.3.2",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_INFLUXDB}"
          },
          "query": "from(bucket: \"${mybucket}\")\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |> filter(fn: (r) => r[\"host\"] == \"${host}\")\n  |> filter(fn: (r) => r[\"_measurement\"] == \"macosgpu\")\n  |> filter(fn: (r) => r[\"_field\"] == \"inUseVidMemoryBytes\")\n  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n  |> yield(name: \"mean\")",
          "refId": "A"
        }
      ],
      "title": "Memory",
      "transformations": [
        {
          "id": "calculateField",
          "options": {
            "binary": {
              "left": "inUseVidMemoryBytes Mac-Pro.local",
              "operator": "/",
              "reducer": "sum",
              "right": "1e9"
            },
            "mode": "binary",
            "reduce": {
              "reducer": "sum"
            },
            "replaceFields": true
          }
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {},
            "indexByName": {},
            "renameByName": {
              "inUseVidMemoryBytes Mac-Pro.local / 1e9": "in use video memory"
            }
          }
        }
      ],
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "${DS_INFLUXDB}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "smooth",
            "lineWidth": 3,
            "pointSize": 6,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "auto",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Fan Speed(%)"
            },
            "properties": [
              {
                "id": "custom.axisPlacement",
                "value": "right"
              },
              {
                "id": "custom.axisColorMode",
                "value": "series"
              },
              {
                "id": "unit",
                "value": "%"
              },
              {
                "id": "displayName",
                "value": "Fan speed"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Temperature(C)"
            },
            "properties": [
              {
                "id": "custom.axisPlacement",
                "value": "left"
              },
              {
                "id": "custom.axisColorMode",
                "value": "series"
              },
              {
                "id": "unit",
                "value": "celsius"
              },
              {
                "id": "displayName",
                "value": "Temperature"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 0,
        "y": 38
      },
      "id": 2,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_INFLUXDB}"
          },
          "query": "from(bucket: \"${mybucket}\")\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |> filter(fn: (r) => r[\"host\"] == \"${host}\")\n  |> filter(fn: (r) => r[\"_measurement\"] == \"macosgpu\")\n  |> filter(fn: (r) => r[\"_field\"] == \"Temperature(C)\" or r[\"_field\"] == \"Fan Speed(%)\")\n  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n  |> yield(name: \"mean\")",
          "refId": "A"
        }
      ],
      "title": "Temperature / Fan Speed",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "${DS_INFLUXDB}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 0,
            "gradientMode": "none",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "lineInterpolation": "smooth",
            "lineWidth": 3,
            "pointSize": 3,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "%"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Device Utilization %"
            },
            "properties": [
              {
                "id": "custom.axisPlacement",
                "value": "left"
              },
              {
                "id": "custom.axisColorMode",
                "value": "series"
              },
              {
                "id": "displayName",
                "value": "Device Utilization"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "GPU Activity(%)"
            },
            "properties": [
              {
                "id": "custom.axisColorMode",
                "value": "series"
              },
              {
                "id": "displayName",
                "value": "GPU Activity"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 12,
        "y": 38
      },
      "id": 5,
      "options": {
        "legend": {
          "calcs": [],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "pluginVersion": "9.3.2",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${DS_INFLUXDB}"
          },
          "query": "from(bucket: \"${mybucket}\")\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |> filter(fn: (r) => r[\"host\"] == \"${host}\")\n  |> filter(fn: (r) => r[\"_measurement\"] == \"MacosIntelGPU\")\n  |> filter(fn: (r) => r[\"_field\"] == \"GPU Activity(%)\" or r[\"_field\"] == \"Device Utilization %\")\n  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n  |> yield(name: \"mean\")",
          "refId": "A"
        }
      ],
      "title": "Utilization",
      "transformations": [],
      "type": "timeseries"
    }
  ],
  "refresh": "5s",
  "schemaVersion": 37,
  "style": "dark",
  "tags": [],
  "templating": {
    "list": [
      {
        "current": {},
        "datasource": {
          "type": "influxdb",
          "uid": "${DS_INFLUXDB}"
        },
        "definition": "import \"influxdata/influxdb/v1\"\n\nv1.tagValues(bucket: \"XRRMonitoring\", tag: \"host\", predicate: (r) => r._measurement == \"system\")\n",
        "hide": 1,
        "includeAll": false,
        "multi": false,
        "name": "host",
        "options": [],
        "query": "import \"influxdata/influxdb/v1\"\n\nv1.tagValues(bucket: \"XRRMonitoring\", tag: \"host\", predicate: (r) => r._measurement == \"system\")\n",
        "refresh": 2,
        "regex": "",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      },
      {
        "description": "XRRMonitoring",
        "hide": 2,
        "label": "mybucket",
        "name": "mybucket",
        "query": "${VAR_MYBUCKET}",
        "skipUrlSync": false,
        "type": "constant",
        "current": {
          "value": "${VAR_MYBUCKET}",
          "text": "${VAR_MYBUCKET}",
          "selected": false
        },
        "options": [
          {
            "value": "${VAR_MYBUCKET}",
            "text": "${VAR_MYBUCKET}",
            "selected": false
          }
        ]
      }
    ]
  },
  "time": {
    "from": "now-15m",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "Macos GPU - Intel+AMD / Apple Silicon",
  "uid": "1zigjla4z",
  "version": 26,
  "weekStart": "",
  "gnetId": 18302,
  "description": "I would like to share a command line tool that can be used in conjunction with the macOS GPU Helper app to gather GPU information from Intel and Apple silicon-based Macs. This tool works together with telegraf to populate an Influxdb bucket, which is then used as a source for Grafana. For help configuring  this tool and to download the helper app, visit https://github.com/XReyRobert/macos-telegraf-gpumonitoring"
}