istio.io/content/zh/docs/ops/integrations/grafana/index.md

4.0 KiB
Raw Permalink Blame History

title description weight keywords owner test
Grafana 关于如何与 Grafana 集成构建 Istio 仪表盘的相关文档。 27
integration
grafana
istio/wg-environments-maintainers no

Grafana 是一个开源的监控解决方案,可以用来为 Istio 配置仪表盘。您可以使用 Grafana 来监控 Istio 及部署在服务网格内的应用程序。

配置

尽管可以构建自己的仪表盘,但 Istio 同时也提供了一组预先配置的仪表盘用来监视网格和控制平面的所有最重要的指标。

可以通过多种方法来配置 Grafana 来使用这些仪表盘:

方法1快速开始

Istio 提供了一个基本的安装示例,以快速启动和运行 Grafana 与所有已经安装的 Istio 仪表盘捆绑在一起:

{{< text bash >}} $ kubectl apply -f {{< github_file >}}/samples/addons/grafana.yaml {{< /text >}}

通过 kubectl apply 方式将 Grafana 部署到集群中。 此策略仅用于演示,并没有针对性能或安全性进行调优。

方法2grafana.com 导入已经部署的 Deployment

如果想要快速地将 Istio 仪表盘导入到现有的 Grafana 实例中,您可以使用 Grafana UI 中的 Import 按钮 来添加上面的仪表盘链接。当导入仪表盘时,请注意必须选择一个 Prometheus 数据源。

也可以使用脚本一次导入所有仪表盘,例如:

{{< text bash >}} $ # Address of Grafana $ GRAFANA_HOST="http://localhost:3000" $ # Login credentials, if authentication is used $ GRAFANA_CRED="USER:PASSWORD" $ # The name of the Prometheus data source to use $ GRAFANA_DATASOURCE="Prometheus" $ # The version of Istio to deploy $ VERSION={{< istio_full_version >}} $ # Import all Istio dashboards $ for DASHBOARD in 7639 11829 7636 7630 7645 13277; do REVISION="(curl -s https://grafana.com/api/dashboards/{DASHBOARD}/revisions -s | jq ".items[] | select(.description | contains(\"{VERSION}")) | .revision" | tail -n 1)" curl -s https://grafana.com/api/dashboards/{DASHBOARD}/revisions/${REVISION}/download > /tmp/dashboard.json echo "Importing(cat /tmp/dashboard.json | jq -r '.title') (revision {REVISION}, id {DASHBOARD})..." $ curl -s -k -u "$GRAFANA_CRED" -XPOST
$ -H "Accept: application/json"
$ -H "Content-Type: application/json"
-d "{\"dashboard\":(cat /tmp/dashboard.json),"overwrite":true,
$ "inputs":[{"name":"DS_PROMETHEUS","type":"datasource",
$ "pluginId":"prometheus","value":"$GRAFANA_DATASOURCE"}]}"
$ $GRAFANA_HOST/api/dashboards/import $ echo -e "\nDone\n" $ done {{< /text >}}

方法3特定的实现方法

Grafana 可以通过其他方法进行安装和配置。要导入 Istio 仪表盘, 请参考文档中的安装方法,例如: