I have exported the dashboards using gcloud alpha monitoring dashboards list --format=json
, but using gcloud dashboard create
using file is not working, basically I want to export the dashboards from one project and import that in other project.
How to export and import google cloud monitoring dashboards between projects using script or API?
The output of the list
sub command probably (didn't test this) has too many dashboards for the create command.
Also, you should remove two fields (name
and etag
). No need to export as json, yaml will also work and is easier to edit anyway.
I did the following:
gcloud monitoring dashboards list
and find the dashboard I was looking for- Note it's
name
property and get the id from the last part in thename
property (a large decimal number or guid) gcloud monitoring dashboards describe $DASHBOARD_ID > dashboard-$DASHBOARD_ID.yaml
the dashboard- Edit the file to remove the
etag
andname
field (thename
is usually located at the end of the file) gcloud monitoring dashboards create --config-from-file dashboard-$DASHBOARD_ID.yaml
Can confirm. Appreciate the answer. –
Sillimanite
You can also copy dashboards using the console by opening the JSON editor of the source project dashboard copying the whole source text, creating a new dashboard in the other project, opening the JSON editor and pasting the text from the clipboard.
© 2022 - 2024 — McMap. All rights reserved.
gcloud dashboard create
with file ? – Dace