Skip to main content

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

 

Hi ​@Marcel Geisen ,

Kindly refer below two documents which can help fetch the list VM configured on the system.

PowerShell command : https://documentation.commvault.com/11.20/get_cvvirtualmachine.html

Get-CVVirtualMachine i-Name <String>] t-Protected] e-UnProtected] e-IncludeTotalCount] n-Skip <UInt64>] t-First <UInt64>] t<CommonParameters>]


Rest API :  https://documentation.commvault.com/v11/essential/rest_api_get_virtual_machines.html


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


Hi ​@Marcel Geisen 

Let me check and update details at the earliest.


@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


@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



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