Solved

CV Rest API | Syntax to get “Media In Library” summary info

  • 4 January 2022
  • 6 replies
  • 290 views

Userlevel 3
Badge +13

 

Hello team,

I use Commvault REST API to grab “Number of spare media” of tape libraries as per CV Bol motioned below so we can be notified if spare media is below the threshold that we set in the Python script.

 

 

https://documentation.commvault.com/commvault/v11_sp20/article?p=48994_1.htm

 

The Python script for CV rest API that I created is running fine and we are getting reports daily with all the required info that we need (e.g. library name, total/available space, SpareMedia count, etc…)

 

 

Issue:

I come across an issue where our Aux copies job stuck in queue due to lack of spareMedia and end up that is Commvault REST API doesn’t  reports accurate SpareMedia Count with the request syntax that outlined in your BOL

https://documentation.commvault.com/commvault/v11_sp20/article?p=48994_1.htm

 

numOfSpareMedia

Tape library total number of spare media.

tapeLibSummary


 

Findings:

CV BOL Rest API only returns the result at root level (tape library summary ), but the accurate SpareMedia count that I’m look for only appears from "Media By location ->Media in the library" level  (attached screenshots)

If you look at my screenshots , the SpareMedia count is different between what I see in tape library summary(spare media: 12) and Media In library (Spare media: 0) :

Commcell console showsTape library summary shows we have 12 spare media

 

However, if go to commcell -> storage reources-> Libraries-> our tape library -> Media By Location -> Media In library (spare media : 0) , we’re running out of spareMedia.

 

Python - get library details Syntax as per CV BOL :

    LibPropsReq = service + "Library/" + str(LibId1)
    headers = {'Cookie2': token}
    r = requests.get(LibPropsReq, headers=headers)

    clientResp = r.text    
    print(clientResp)

 

raw output of above command

<EVGui_GetLibraryInfoWCResp><libraryInfo description="" libraryUsedForLogCaching="0" extendedAttributes="394" manufacturer="XX" storagePoolType="-1" libraryVendorId="0" model="XXX" libraryType="1" status=""><tapeLibSummary numOfCleaningMedia="2" offlineReason="N/A" numOfIESlots="0" lastDayThroughput="484.59 GB/Hr" isOnline="Yes" numOfIESlotOccupied="0" lastRestoreTime="Dec 10 2021  9:56AM" numOfActiveMedia="8" numOfSpareMedia="12" vendor="HP" numOfRegSlots="80" model="XXX" ...

custom output of above command:

HP XXXX sparemedia: 12

 

Questions:

 

What’s the CV REST API request Syntax to get “Media In Library” summary info for the tape library only so we can get more accurate information about the SpareMedia count.

 

I have search in CV BOL/MA, etc and it doesn’t bring any search result

 

thanks

 

 

 

 

icon

Best answer by Mike Struening RETIRED 15 February 2022, 18:58

View original

6 replies

Userlevel 7
Badge +23

Hey @DanC,

Thanks for your question - let me see if I can find somebody that knows this stuff really well to take a look.

Badge

Also, REST APIs for reports can be used to extract information from “Tape details" report and filter by Library = “<Library Name>”, “Location Status” = “In Library” and “Status” = “Spare”

https://documentation.commvault.com/commvault/v11_sp20/article?p=115149_1.htm

https://documentation.commvault.com/commvault/v11_sp20/article?p=115046_1.htm

Userlevel 3
Badge +13

thank you, Damian

Userlevel 2
Badge +7

Hi! 

Working on similar case. I see numOfSpareMediaInLib has been added. I’d like to get also numOfAgedMedia, but filter only ones present in library. It would get number of tapes that can be used by new jobs. 

It’s possible to calculate numOfAgedMediaInLib or add this field in future releases? 

Userlevel 7
Badge +23

Hey @DanC , apologies for the delay!

I looked up and down and found the following:

The info is not available via API now.  However, the info can be obtained from "Tape details" custom report which allows filtering by location and media type
https://cloud.commvault.com/webconsole/softwarestore/store.do#!/135/664/10156

I created a CMR for you to get this feature added:

CMR #: 346887

Userlevel 3
Badge +13

thanks @Mike Struening and @RohitSivadas 

Reply