Share via


az grafana dashboard

注意

此參考是 Azure CLI 的 amg 延伸模組的一部分(2.38.0 版或更高版本)。 擴充功能會在您第一次執行 az grafana 儀錶板 命令時自動安裝。 深入了解擴充功能。

管理實例儀錶板的命令。

命令

名稱 Description 類型 狀態
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 dashboard 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

標識碼、uid、標題,可識別資料夾。 CLI 會依標識碼、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

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 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 dashboard 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

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 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 Container Insights” 的儀錶板。

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 資源庫識別碼、具有這類內容之檔案的路徑或 URL 中的完整儀錶板模型。

--name -n

Azure 受控 Grafana 的名稱。

選擇性參數

--api-key --token -t

Api 金鑰或服務帳戶令牌,這是隨機產生的字串,用來與 Grafana 端點互動;如果遺失,CLI 將會使用目前登入用戶的認證。

--folder

標識碼、uid、標題,可識別資料夾。 CLI 會依標識碼、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

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 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 dashboard 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

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 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 dashboard 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

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 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

目的地工作區的資源標識碼。

--source -s

來源工作區的資源標識碼。

選擇性參數

--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

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 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 dashboard 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

標識碼、uid、標題,可識別資料夾。 CLI 會依標識碼、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

訂用帳戶的名稱或識別碼。 您可以使用 來設定預設訂用 az account set -s NAME_OR_ID帳戶。

--verbose

增加記錄詳細資訊。 使用 --debug 來取得完整偵錯記錄。