

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

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

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

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

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

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

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

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

### 为边缘数据创建 Grafana 控制面板 SiteWise
<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": ""
  }
  ```