Skip to main content

Can someone knows on how to lists all the subclient backup jobs history using cvpysdk? 

 

Any sample syntax that we can follow?

Please follow the below steps:

 

“””The below is for a specific subclient”””

 

from cvpysdk.commcell import Commcell

c = Commcell("<cs-name>", "<username>", "<password>")

cl = c.clients.get("<client-name>")

agent = cl.agents.get("<agent name>")

backupset = agent.backupsets.get("<backupset name>")

subclient = backupsets.subclients.get("<subclient name>")

>>> subclient.subclient_id

'6653' # subclient id

 

entity_dict = {" subclientId": <id of the subclient>}  #dont give single or double quotes here

job_controller = c.job_controller

job_controller.finished_jobs(client_name="<client name>", lookup_time=<number in hours>, job_filter="Backup,SYNTHFULL", entity=entity_dict) # dont give single or double quotes in number in hours, lookup_time is to get all the jobs executed within the number of hours

 


 

If you only want to filter by client then follow these steps:

 

from cvpysdk.commcell import Commcell

 

c = Commcell("<cs-name>", "<username>", "<password>")

job_controller = c.job_controller

job_controller.finished_jobs(client_name="<client name>", lookup_time=<number in hours>, job_filter="Backup,SYNTHFULL")

 


Example:

 

>>> cl = c.clients.get("san-desh")

>>> agent = cl.agents.get("file system")

>>> backupset = agent.backupsets.get("Test_48744")

>>> subclient = backupsets.subclients.get("default")

>>> subclient.subclient_id

'6653'

>>> job_controller = c.job_controller

>>> entity_dict = {"subclientId": 6653}

 

>>> job_controller.finished_jobs(client_name="san-desh", lookup_time=500, job_filter="Backup,SYNTHFULL", entity=entity_dict)

 

Output:

 

{666639: {'operation': 'Backup', 'status': 'Completed', 'app_type': 'Windows File System', 'job_type': 'Backup', 'percent_complete': 100, 'pending_reason': '', 'client_id': 1763, 'client_name': 'san-desh', 'subclient_id': 6653, 'backup_level': 'Full', 'job_start_time': 1720595206, 'job_elapsed_time': 1906}}

 


Hi @Swatish , Just got back here. I will try your recommendation and it seems good.

 

Appreciate your help. Thank you!


Hi @Swatish I tried it just now and it works! 

 

I need to think of way on how to make the dict format converted into csv or table format just like what we can see in the Backup job history from the console.


Reply