Question

REST API Call to get all devices which are currently backed up

  • 17 April 2024
  • 7 replies
  • 48 views

Badge +1

Hello everyone,

I’m quite new to Commvault and only the “secondary admin” but the API guy in the team. We’re running Commvault 11.32.45 in a local VM and have several media agents across our datacenters (no cloud anywhere).

I want to get all the devices which are backed up with any job right now. I don’t care if it’s a VM or a physical machine, a database server or a file server. All I need is the device name and maybe the backup job backing up the device.

I want to use this information to request details per device from our central DCIM (Netbox) and create a simple list of devices + details.

I managed to get clients and subclients via the api but it’s very confusing. There seem to be several apis and several documentations for them.

  1. What’s the currently recommended API in general? webconsole, commandcenter, WebServerCore, CVWebService.svc?
  2. Which documentation should I follow? documentation.commvault.com, api-next.commvault.com, one I didn’t find yet?
  3. Is there a straight forward way to get ALL devices which are currently backed up? Or am I on the wrong way?

Thanks for any help!

Greetings

Mike


7 replies

Userlevel 5
Badge +12

@MikeDRG ,

If you run a job summary report using the default time frame of last 24 hours, that will list of the jobs that ran the client and subclient names. Which I believe will give you what you are looking for. If need be the report can be saved as a csv file.

Regards,

Edward J Holowienka

Badge +1

@HolowEd 

thanks for the reply!

I’m sure I can run the report automatically, right? Can I also access the csv file directly from my script?

Yes, there is a “dirty” way of doing that via APi:)
https://documentation.commvault.com/2023e/essential/rest_api_post_qcommand.html

Section: Sample Requests: DataProtectionJobSummary

Badge +1

is there also a clean way to achieve what I wanna do?

Userlevel 4
Badge +11

HI @MikeDRG ,

Maybe something like this?

https://api.commvault.com/docs/SP34/api/cv/OpenAPI3/get-servers

 

For API documentation I would use api.commvault.com

 

And in regards of which API to use, all endpoints should provide the same functionality, it should only depend on which ones are available to you

https://documentation.commvault.com/2023e/essential/available_web_services_for_rest_api.html

Badge +1

Hi @Javier 

I tried https://<FQDN-of-commcell>/webconsole/api/V4/Servers?showOnlyInfrastructureMachines=0 and it only returned 197 objects which is exactly the number of clients in “Client Computers” (viewed in Commcell Console) - I guess this is “all objects which have an agent”.

It’s kinda what I want but I also need virtual machines which don’t have an agent.

Didn’t expect it to be so complicated to get a list of devices :D

Userlevel 5
Badge +12

@MikeDRG ,

You will probably also need to run this API Request to get the list of virtual machines https://documentation.commvault.com/2023e/essential/rest_api_get_virtual_machines.html.

Regards,

Edward J Holowienka

Reply