

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 为 Edge 设置 Graf SiteWise ana
<a name="windows-grafana"></a>

 Grafana® 允许您为工业数据创建本地实时监控仪表板。通过对存储在InfluxDB® 中的数据进行可视化，您可以让操作员即时了解设备性能、过程效率和潜在问题。这种边缘可见性对于时间敏感型操作和在网络中断期间保持连续性非常重要。

## 配置数据来源
<a name="windows-grafana-data-source-config"></a>

将Grafana连接到您的InfluxDB数据库可为您的工业数据创建强大的可视化层。这种连接支持实时监控仪表板，操作员可以使用这些仪表板做出明智的决策，而无需依赖云端。

1. 在浏览器中导航到:3000 [ http://127.0.0.1 即可在本地访问您的 Grafana 实例。](http://127.0.0.1:3000)如果需要启用 TLS，可以参考*Grafana Labs*文档[中的](https://grafana.com/docs/grafana/latest/setup-grafana/set-up-https/)设置 Grafana HTTPS 以实现安全的网络流量。

1. 添加一个指向写入数据的InfluxDB时间序列存储桶的InfluxDB数据源。 Node-RED 例如 `WindFarmData`。这种连接在您存储的数据和可视化平台之间建立了链接。

1. 有关详细说明，请参阅文档[中的](https://grafana.com/docs/grafana/latest/datasources/influxdb/configure-influxdb-data-source/)配置 InfluxDB 数据源。* Grafana Labs *

### 为 SiteWise Edge 数据创建 Grafana 仪表板
<a name="windows-grafana-create-dashboard"></a>

创建仪表板是构建本地监控解决方案的最后一步。仪表板可直观地呈现您的工业数据，使您更容易一目了然地识别趋势、异常和潜在问题。
+ 按照指南创建仪表板。有关更多信息，请参阅*Grafana Labs文档[中的](https://grafana.com/docs/grafana/latest/getting-started/build-first-dashboard/)构建您的第一个仪表板*。此模板假设您的存储桶已命名`WindFarmData`，度量值为`TurbineData`。

  您还可以通过导入提供的示例仪表板模板来使用快速入门指南，为上一节中 Node-RED 生成的数据快速创建带有时间序列图的仪表板。此模板提供了一个起点，您可以对其进行自定义以满足特定的监控需求。

  ```
  {
    "__inputs": [
      {
        "name": "DS_WINDFARM-DEMO",
        "label": "windfarm-demo",
        "description": "",
        "type": "datasource",
        "pluginId": "influxdb",
        "pluginName": "InfluxDB"
      }
    ],
    "__elements": {},
    "__requires": [
      {
        "type": "grafana",
        "id": "grafana",
        "name": "Grafana",
        "version": "11.6.0-pre"
      },
      {
        "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_WINDFARM-DEMO}"
        },
        "fieldConfig": {
          "defaults": {
            "color": {
              "mode": "palette-classic"
            },
            "custom": {
              "axisBorderShow": false,
              "axisCenteredZero": false,
              "axisColorMode": "text",
              "axisLabel": "",
              "axisPlacement": "auto",
              "barAlignment": 0,
              "barWidthFactor": 0.6,
              "drawStyle": "line",
              "fillOpacity": 0,
              "gradientMode": "none",
              "hideFrom": {
                "legend": false,
                "tooltip": false,
                "viz": false
              },
              "insertNulls": false,
              "lineInterpolation": "linear",
              "lineWidth": 1,
              "pointSize": 5,
              "scaleDistribution": {
                "type": "linear"
              },
              "showPoints": "auto",
              "spanNulls": false,
              "stacking": {
                "group": "A",
                "mode": "none"
              },
              "thresholdsStyle": {
                "mode": "off"
              }
            },
            "mappings": [],
            "thresholds": {
              "mode": "absolute",
              "steps": [
                {
                  "color": "green"
                },
                {
                  "color": "red",
                  "value": 80
                }
              ]
            }
          },
          "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": "single",
            "sort": "none"
          }
        },
        "pluginVersion": "11.6.0-pre",
        "targets": [
          {
            "datasource": {
              "type": "influxdb",
              "uid": "${DS_WINDFARM-DEMO}"
            },
            "query": "from(bucket: \"{{WindFarmData}}\")\n  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\n  |> filter(fn: (r) => r[\"_measurement\"] == \"{{TurbineData}}\")\n  |> filter(fn: (r) => r[\"_field\"] == \"value\")\n  |> filter(fn: (r) => r[\"name\"] == \"/Renton/WindFarm/Turbine/WindSpeed\")\n  |> filter(fn: (r) => r[\"quality\"] == \"GOOD\")\n  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)\n  |> yield(name: \"mean\")",
            "refId": "A"
          }
        ],
        "title": "Panel Title",
        "type": "timeseries"
      }
    ],
    "schemaVersion": 41,
    "tags": [],
    "templating": {
      "list": []
    },
    "time": {
      "from": "now-6h",
      "to": "now"
    },
    "timepicker": {},
    "timezone": "browser",
    "title": "demo dashboard",
    "uid": "fejc0t08o6d4wb",
    "version": 1,
    "weekStart": ""
  }
  ```