你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

az grafana dashboard

注意

此参考是 Azure CLI(版本 2.38.0 或更高版本)的 amg 扩展的一部分。 该扩展将在首次运行 az grafana 仪表板 命令时自动安装。 详细了解扩展。

用于管理实例仪表板的命令。

命令

名称 说明 类型 状态
az grafana dashboard create

创建新的仪表板。

扩展 GA
az grafana dashboard delete

删除仪表板。

扩展 GA
az grafana dashboard import

导入仪表板。

扩展 GA
az grafana dashboard list

列出实例的所有仪表板。

扩展 GA
az grafana dashboard show

获取仪表板的详细信息。

扩展 GA
az grafana dashboard sync

将 Azure 托管 Grafana 仪表板从一个实例同步到另一个实例。 请注意,由于只读,将跳过具有“已预配”状态的仪表板。

扩展 预览
az grafana dashboard update

更新仪表板。

扩展 GA

az grafana dashboard create

创建新的仪表板。

az grafana dashboard create --definition
                            --name
                            [--api-key]
                            [--folder]
                            [--overwrite {false, true}]
                            [--resource-group]
                            [--title]

示例

在 json 文件中创建具有定义的仪表板。 对于快速入门,请从“az grafana 仪表板 show”的输出克隆,删除“id”和“uid”,并应用更改。

az grafana dashboard create -g MyResourceGroup -n MyGrafana --title "My dashboard" --folder folder1 --definition '{
  "dashboard": {
    "annotations": {
        ...
    },
    "panels": {
        ...
    }
  },
  "message": "Create a new test dashboard"
}'

必需参数

--definition

json 字符串中的完整仪表板模型、包含此类内容的文件的路径或 URL。

--name -n

Azure 托管 Grafana 的名称。

可选参数

--api-key --token -t

API 密钥或服务帐户令牌,这是一个随机生成的字符串,用于与 Grafana 终结点交互;如果缺少,CLI 将使用当前登录用户的凭据。

--folder

标识文件夹的 ID、uid、标题。 CLI 将按 ID、uid 和标题的顺序搜索,直到找到匹配项。

--overwrite

使用相同的 uid 覆盖仪表板。

接受的值: false, true
--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

--title

仪表板的标题。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az grafana dashboard delete

删除仪表板。

az grafana dashboard delete --dashboard
                            --name
                            [--api-key]
                            [--resource-group]

示例

删除唯一标识符指定的仪表板(使用“az grafana 仪表板 list”命令检索 uid)

az grafana dashboard delete -g MyResourceGroup -n MyGrafana --dashboard VdrOA7jGz

必需参数

--dashboard

仪表板 uid。

--name -n

Azure 托管 Grafana 的名称。

可选参数

--api-key --token -t

API 密钥或服务帐户令牌,这是一个随机生成的字符串,用于与 Grafana 终结点交互;如果缺少,CLI 将使用当前登录用户的凭据。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az grafana dashboard import

导入仪表板。

CLI 命令将填写数据源的必需参数(如果已配置)。

az grafana dashboard import --definition
                            --name
                            [--api-key]
                            [--folder]
                            [--overwrite {false, true}]
                            [--resource-group]

示例

从 Grafana 库导入“AKS 容器见解”的仪表板。

az grafana dashboard import -g MyResourceGroup -n MyGrafana --definition 12180

从文件导入仪表板。

az grafana dashboard import -g MyResourceGroup -n MyGrafana --definition @c:\temp\dashboard.json

必需参数

--definition

json 字符串、Grafana 库 ID、包含此类内容的文件的路径或 URL 的完整仪表板模型。

--name -n

Azure 托管 Grafana 的名称。

可选参数

--api-key --token -t

API 密钥或服务帐户令牌,这是一个随机生成的字符串,用于与 Grafana 终结点交互;如果缺少,CLI 将使用当前登录用户的凭据。

--folder

标识文件夹的 ID、uid、标题。 CLI 将按 ID、uid 和标题的顺序搜索,直到找到匹配项。

--overwrite

使用相同的 uid 覆盖仪表板。

接受的值: false, true
--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az grafana dashboard list

列出实例的所有仪表板。

az grafana dashboard list --name
                          [--api-key]
                          [--resource-group]

示例

查找 K8s API 服务器的仪表板并检索唯一标识符(以便调用“az grafana 仪表板 show”命令)

az grafana dashboard list -g MyResourceGroup -n MyGrafana --query "[?contains(@.title, 'API server')].uid"

必需参数

--name -n

Azure 托管 Grafana 的名称。

可选参数

--api-key --token -t

API 密钥或服务帐户令牌,这是一个随机生成的字符串,用于与 Grafana 终结点交互;如果缺少,CLI 将使用当前登录用户的凭据。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az grafana dashboard show

获取仪表板的详细信息。

az grafana dashboard show --dashboard
                          --name
                          [--api-key]
                          [--resource-group]

示例

获取唯一标识符指定的仪表板的详细信息(使用“az grafana 仪表板 list”命令检索 uid)

az grafana dashboard show -g MyResourceGroup -n MyGrafana --dashboard VdrOA7jGz

必需参数

--dashboard

仪表板 uid。

--name -n

Azure 托管 Grafana 的名称。

可选参数

--api-key --token -t

API 密钥或服务帐户令牌,这是一个随机生成的字符串,用于与 Grafana 终结点交互;如果缺少,CLI 将使用当前登录用户的凭据。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az grafana dashboard sync

预览

此命令处于预览阶段,正在开发中。 参考和支持级别: https://aka.ms/CLI_refstatus

将 Azure 托管 Grafana 仪表板从一个实例同步到另一个实例。 请注意,由于只读,将跳过具有“已预配”状态的仪表板。

az grafana dashboard sync --destination
                          --source
                          [--dashboards-to-exclude]
                          [--dashboards-to-include]
                          [--dry-run {false, true}]
                          [--folders-to-exclude]
                          [--folders-to-include]

示例

仅在几个文件夹下同步仪表板

az grafana dashboard sync --source /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workspaces/providers/Microsoft.Dashboard/grafana/source --destination /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workspaces/providers/Microsoft.Dashboard/grafana/destination --folders-to-include "Azure Monitor Container Insights" "Azure Monitor"

同步单个仪表板

az grafana dashboard sync --source /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workspaces/providers/Microsoft.Dashboard/grafana/source --destination /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workspaces/providers/Microsoft.Dashboard/grafana/destination --folders-to-include "MyFolder" --dashboards-to-include "My Service Health"

预览同步

az grafana dashboard sync --source /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workspaces/providers/Microsoft.Dashboard/grafana/source --destination /subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workspaces/providers/Microsoft.Dashboard/grafana/destination --dry-run

必需参数

--destination -d

目标工作区的资源 ID。

--source -s

源工作区的资源 ID。

可选参数

--dashboards-to-exclude

要同步中排除的仪表板的空格分隔标题。与特定文件夹的 --folders-to-exclude 配对。

--dashboards-to-include

要包含在同步中的仪表板的空格分隔标题。与特定文件夹的 --folders-to-include 配对。

--dry-run

预览更改,w/o 提交。

接受的值: false, true
--folders-to-exclude -e

备份或同步中要排除的文件夹。

--folders-to-include -i

要包含在备份或同步中的文件夹。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。

az grafana dashboard update

更新仪表板。

az grafana dashboard update --definition
                            --name
                            [--api-key]
                            [--folder]
                            [--overwrite {false, true}]
                            [--resource-group]

示例

使用 json 文件中的定义更新仪表板。 有关快速入门,请从“az grafana 仪表板 show”获取现有配置,并应用更改。 需要更新“version”字段,“overwrite”字段应为 true。

az grafana dashboard update -g MyResourceGroup -n MyGrafana --definition @c:\temp\dashboard.json

必需参数

--definition

json 字符串中的完整仪表板模型、包含此类内容的文件的路径或 URL。

--name -n

Azure 托管 Grafana 的名称。

可选参数

--api-key --token -t

API 密钥或服务帐户令牌,这是一个随机生成的字符串,用于与 Grafana 终结点交互;如果缺少,CLI 将使用当前登录用户的凭据。

--folder

标识文件夹的 ID、uid、标题。 CLI 将按 ID、uid 和标题的顺序搜索,直到找到匹配项。

--overwrite

使用相同的 uid 覆盖仪表板。

接受的值: false, true
--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name> 配置默认组。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

--help -h

显示此帮助消息并退出。

--only-show-errors

只显示错误,取消显示警告。

--output -o

输出格式。

接受的值: json, jsonc, none, table, tsv, yaml, yamlc
默认值: json
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

提高日志记录详细程度。 使用 --debug 获取完整的调试日志。