Solved

backup details from python sdk

  • 17 December 2021
  • 15 replies
  • 268 views

Badge +2

Please suggest me which python script to fetch backup time of agent which we install in client machine & backup done details of backup (Like - Time ,Status,Backup Size)

I’m trying with this https://github.com/Commvault/cvpysdk/blob/master/cvpysdk/reports/report.py

some part of the code like backup job summary & report but i didn’t get the details.

Thank in Advance

icon

Best answer by Mike Struening RETIRED 18 April 2022, 23:25

View original

15 replies

Userlevel 7
Badge +15

Hi @Dheeraj 

Thanks for the question and welcome to the Community!

You can use cvpysdk to perform commcell operational actions, please take a look at documentation root:

Commvault cvpysdk documentation.

The module you have selected to use is cvpysdk.reports.report.

The description suggests:

Module for performing operations on classic Reports.

Report : Class for selecting different options on report and generate the report.

BackupJobSummary : Generate backup job summary report.

FormatType : Use this Enum class to provide different file extension.

 

You will need to instantiate an object of the Backupjobsummary class and then perform operations on that object to select specific days/hours and which clients/client groups you want to run the report on.

Please take a look at the documentation and try running some scripts with Backupjobsummary class objects and let me know how you get on.

Thanks,

Stuart

Badge +2

I’ll try the https://commvault.github.io/cvpysdk/cvpysdk/reports/report.html this code.

Here i use the Job Controller(class) where i get the Job ID after that, i’ll use Job (Class) Where i use _get_jobs_list , all_jobs , finished_jobs. With help of Job ID i will find the summary of that report.

But i did not get the report like this format which i get through the Commcell Web UI format,

With the python SDK i get incomplete report so here i share you one image that can you help me how i get this type of report.

Here I share you code what i’m doing right now :-

from cvpysdk.commcell import Commcell
from cvpysdk.job import JobController
from cvpysdk.job import Job

commcell = Commcell(***)
job_c = JobController(commcell)
print(job_c)
job_list = job_c._get_jobs_list(lookup_time=24)
print('list of job',job_list)
for key,value in job_list.items():
    print(key)
    c = (value['job_type'])
    print(c)
    if "Backup" == c or "1-Touch Backup" ==  c:
        dataa = (key)
        print(dataa)
        job = Job(commcell,key)
        print(job)
        summ = job.summary
        print(summ)

 

Here i’m not get all the Job ID, can you help me out with that i get all job id which is coming in the Commcell web UI.

Userlevel 7
Badge +23

@Dheeraj , are you not seeing the same job range, or are you not getting the same columns?

Badge +2

Hey Mike,

I’m not getting the same job range details when I’m fetching the data from SDK.

In Commcell Web UI I got the details of the last 24 hours(lookup_time) of all VM backup but when I’m using SDK I will not get all job backup range, there is some missing Job ID, so can you help me out how I get that missing all JOB ID.

Userlevel 7
Badge +23

To confirm, you are limiting the range to 24 hours in the SDK version, but not seeing the same job list as you do in the web UI?

Is there any consistency amongst the missing jobs?  Is it only a handful or a large portion?  If we can determine a pattern to what is missing, we have a place to start.

It likely will end with creating a support incident, though I want to see how far we can get here.

Badge +2

Hey Mike,

To confirm, you are limiting the range to 24 hours in the SDK version, but not seeing the same job list as you do in the web UI?  - YES

Is there any consistency amongst the missing jobs?  Is it only a handful or a large portion?  If we can determine a pattern to what is missing, we have a place to start.  -  Yeah Mike, i’m monitoring last 7 days one by one,but i did not get all job range there some missing Job ID(For Particular machine i did not get Job ID in SDK when i was monitor last 7 days).

 

Userlevel 7
Badge +23

Thanks for the additional detail!

So to confirm, the missing job IDs are all for one particular machine (or group of machines)?

What makes these different from the ones you ARE seeing?  Are they vms?  perhaps the sub job IDs for VSA subclients?

Badge +2

So to confirm, the missing job IDs are all for one particular machine (or group of machines)?  - Yes, it is particular machine.

 

What makes these different from the ones you ARE seeing?  Are they vms?  perhaps the sub job IDs for VSA subclients? -  In these vm i did not get the job ID(missing Job ID) .

  • They are VM which i did not get any job ID via SDK
  • the only difference is the VM which i get JOB ID via SDK is that I take that VM backup option is  - file & folder wise which i get the JOB ID.
  • JOB id i did not get that VM  that is i take backup as whole VM BACKUP including file & folder.

Now these are different i understand can you give me any solution .!!

 

 

 

Userlevel 7
Badge +23

Appreciate the detail.  Based on what you’re saying, we are not grabbing that ‘type’ of job, either through the actual modules or through the script itself.

I’m going to talk to some internal folks and get them to reply here.  We may need a support case, though let’s see what my contacts can do to help first!

Badge +2

Hey Mike,Thanks for your support,kindly can you take this issue in urgent basis.

I’m waiting your reply,Mike

Badge +2

Appreciate the detail.  Based on what you’re saying, we are not grabbing that ‘type’ of job, either through the actual modules or through the script itself.

I’m going to talk to some internal folks and get them to reply here.  We may need a support case, though let’s see what my contacts can do to help first!

Hey mike,

Is there any update on it.

Userlevel 7
Badge +23

@Dheeraj , apologies for the delay (I was on a week long vacation and just got back).

Advice here is to open a support case so we can investigate deeper.

Once you create the incident, send me the case number so I can track it.

Thanks!

Userlevel 7
Badge +23

@Dheeraj , did you end up creating a case for this issue?  Let me know if you found a solution otherwise.

Thanks!

Userlevel 7
Badge +23

@Dheeraj , did you end up creating a case for this issue?  Let me know if you found a solution otherwise.

Thanks!

Userlevel 7
Badge +23

@Dheeraj , I’m marking this as closed as I do not see any incident created.  If you did end up resolving this, please share the fix with us here (and if not and you want to pursue, please open a case and share the number here so I can track it)!

Reply