Export VCF Operations Dashboards with Everything Included

If you've ever built a VCF Operations Dashboard and exported it, you know you only get the Dashboard itself upon export. If your Dashboard is using Views, Super Metrics, Custom Groups, Custom Profiles, etc you must export them separately. This is less than ideal, so I created some tooling to do it for me, here it is.
Running it CLI looks like this:
python3 vcf_ops_dashboard_exporter.py --host 192.168.135.113 -u admin -d "Cluster Capacity Details v7" --insecure --import-to 192.168.135.110 --enable-in-policiesIn this case I'm exporting a Dashboard called Cluster Capacity Details v7 from the first Operations instance and importing it (along with requisite Views, Super Metrics, etc) into the second Operations instance.
Among other things, the output will show what's being export/imported. In this case it contains this:
Exported to /Users/brockp/Downloads/vcfops-export/Custom Dashboards_Cluster Capacity Details v7
dashboards 1
views 2
supermetrics 8
customgroups 0
customprofiles 0
configfiles 0Once executed it will also show the Dashboard, Views, and Super Metrics in this case.
Dashboards (1)
Custom Dashboards/Cluster Capacity Details v7 [1a6f7f84-ff5c-4b2d-a0af-c87787f2b219]
Views (2)
Cluster Details v4 [5f632325-73d3-4d2d-8b65-196870feda5c]
ESXi Host Details v4.1 [f3044452-518c-4a31-af57-04d5ba7bb871]
Super metrics (8)
CPU Free [cd1795d2-ca24-4c00-b792-f7d8c98573a6]
CPU Free after 1 Failed Host [47a9fcc8-692f-45ff-a8a2-011c62507ebe]
CPU Free after 2 Failed Hosts [8af462e1-4926-4ded-ab4f-9adaad96e5f9]
Failed ESXi Host Capacity [e7518cbe-1af2-4e51-b0a0-da722033eb85]
Memory Free [6fa62bc0-3f89-42c7-9ff3-77745cac3e1b]
Memory Free after 1 Failed Host [dd25ecf1-9f40-456d-96eb-d0213f3fb83c]
Memory Free after 2 Failed Hosts [43c4f252-ede8-40eb-96ad-5ec05d5aee74]
Two Failed ESXi Hosts Capacity [285f806a-60fc-4e92-b65c-f65209d7528a]
Custom groups (0)
(none)
Custom profiles (0)
(none)
Config files (0)
(none)It will also indicate the Policy/s the Super Metrics were Enabled in.
Policy changes (applying) in 1 active policy:
vSphere Solution's Default Policy (Nov 25, 26 7:59:10 AM) super metrics enabled: Failed ESXi Host Capacity on ClusterComputeResource; Memory Free on ClusterComputeResource; Two Failed ESXi Hosts Capacity on ClusterComputeResource; Memory Free after 1 Failed Host on ClusterComputeResource; Memory Free after 2 Failed Hosts on ClusterComputeResource; CPU Free after 2 Failed Hosts on ClusterComputeResource; CPU Free after 1 Failed Host on ClusterComputeResource; CPU Free on ClusterComputeResourceThere is a README available here with documentation.
Logging into the Operations instance the Dashboard was imported into, there it is!

Including the necessary Views and Super Metrics (enabled in Policy/s), exactly what I wanted. I do have a feature request open for this in product, hopefully it will be coming sooner than later.
If you don't want to use CLI, there is a GUI option as well. You launch it by downloading the vcfops_dashboard_export_guy.py from the link above and running the following.
python3 vcf_ops_dashboard_exporter_gui.pyI'm running it locally on MacOS. When launched it'll spawn a browser tab and look like this.

Provide the VCF Operations instance you're connecting to and click Connect to source. Once connected click Next: choose a dashboard to select the Dashboard you want to export.

Then click Run export which exporting all Content via the Content Management API. We must use this API endpoint as there is no API endpoint to export Dashboards.

Next you search for the Dashboard you want here.

Next click Find dependencies and continue.

Next provide the target Operations instance, credentials, and click Connect to target.

Confirm the connection and click Next: review dependencies.

You can now review the Dashboard and its dependencies, in this case Views and
Super Metrics. Click Next: import.

Here you can select what you want to import (option to replace content if it already exists). You can import Custom Profiles and/or Super Metrics (with an option to enable them in Policy/s if you'd like). Click Import.

Confirm and click Import now. Status is given at the bottom, to see more details select Show activity.

You are also given more details on exactly what was imported. Now if you log into the target VCF Operations instance you'll see the Dashboard, Views, and Super Metrics (enabled in the Policy/s selected).
This is a great workaround until VCF Operations Dashboard exports include all requisite constructs (Views, Super Metrics, etc) from within the product itself. Hope this was helpful, enjoy!



Comments