This article will help you generate and export a list of Virtual Machines (VMs) along with their status (managed, onboarded, or discovered) from VMware Aria Automation.
Currently, there is no option to directly export this data from the VMware Aria Automation UI. This guide provides a detailed workaround by querying the VMware Aria Automation database.
The list of VMs can be generated by running a SQL query against the VMware Aria Automation database. Carefully follow the steps below to export the list in CSV format.
.sql
extension. For example, name it VMStatusQuery.sql
.SELECT name, state, origin FROM dep_resource WHERE type='Cloud.vSphere.Machine';
for pod in $(kubectl get pods --namespace prelude -l app=postgres -o jsonpath='{.items[?(@.status.phase=="Running")].metadata.name}'); do
if kubectl exec --namespace prelude -it $pod -- /bin/bash -c "chpst -u postgres -- psql -t -c 'SELECT pg_is_in_recovery();'" | grep -q "f"; then
echo "Writable master found: $pod"
break
fi
done
.sql
file to the VMware Aria Automation appliance. Place it in the /data
directory.root
.chown postgres:postgres /data/VMStatusQuery.sql
chmod 666 /data/VMStatusQuery.sql
vracli dev psql
yes
and press Enter.\c catalog-db;
\o /data/VMStatus.csv;
\i /data/VMStatusQuery.sql;
\o
/data/VMStatus.csv
.Additional Information: