Skip to main content
Question

Phython SDK - Get All Virtual machines

  • January 16, 2025
  • 6 replies
  • 95 views

Forum|alt.badge.img+8

We are Service Provider and our Dev Team is writing a new Monitoring Script for monitoring the Backup Status of all Backups for each Server for the last 24 hours.

They want to use the Python SDK. The Skript is working fine, only problem is to get a list of all virtual machines, because if a Server has no CV Agent installed and has only VSA Backup it is not in the Client list.

So my question is, is there an easy way to get all virtual machine names of all hypervisors listed with the Python SDK, we found no sub-modul doing that.

 

Thanks for any help and Best Regards

Marcel

 

6 replies

Forum|alt.badge.img+11
  • Vaulter
  • 249 replies
  • January 17, 2025

Forum|alt.badge.img+8

Hello Pradeep,

thanks for reply, with REST API I know but as I wrote our Dev Team is using the Python SDK and they want to get a VM list via the SDK.

So and there I did not found any modul etc…

Maybe anyone already did it with Python SDK…

Thx & BR

Marcel


Forum|alt.badge.img+11
  • Vaulter
  • 249 replies
  • January 17, 2025

Hi ​@Marcel Geisen 

Let me check and update details at the earliest.


Forum|alt.badge.img+11
  • Vaulter
  • 249 replies
  • January 17, 2025

@Marcel Geisen 

Kindly refer below document and module.

https://commvault.github.io/cvpysdk/cvpysdk/client.html#cvpysdk.client.Clients.add_exchange_client

_get_virtualization_clients() -- gets all the virtualization clients associated with the commcell


Forum|alt.badge.img+8

@Pradeep thanks for checking again, with get_virtualization_clients you only get the hypervisor objects and not the virtual machines… this we already tested before, because we thought the same as you.

So till now I could not find an easy way to get with Python SDK.

Thx


Forum|alt.badge.img+2
  • Byte
  • 6 replies
  • January 20, 2025


Hi Marcel,

 

commcell = cvpysdk.commcell.Commcell('<CS Name>','<UserName>','<Password>',

force_https=True,verify_ssl=False)

 

client = cvpysdk.clients.vmclient.VMClient(commcell,client_name='<Virtualization Client Name here>')

agent = client.agents.get('Virtual Server')

backupsets = agent.backupsets.get('defaultBackupSet')

 

Content = cvpysdk.subclients.virtualserver.vmware.VMWareVirtualServerSubclient(backupset_object=backupsets,subclient_name='<Subclient Name>')

 

print(Content.preview_content())

please check if it works


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings