Skip to main content
Question

cvpysdk - lists all backup jobs history from specific client


Forum|alt.badge.img+3
  • Byte
  • 5 replies

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

 

Any sample syntax that we can follow?

3 replies

Forum|alt.badge.img
  • 1 reply
  • July 30, 2024

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}}

 


Forum|alt.badge.img+3
  • Author
  • Byte
  • 5 replies
  • August 2, 2024

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

 

Appreciate your help. Thank you!


Forum|alt.badge.img+3
  • Author
  • Byte
  • 5 replies
  • August 2, 2024

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


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