Solved

Backup automation check for VMs and FS agents

  • 6 October 2021
  • 9 replies
  • 90 views

Badge +1

Hi!

 

I was trying to create a script using python for VM and FS clients that are configured on our Commvault software.

I’ve used several references (below is a sample) and used the sandbox API

https://documentation.commvault.com/11.24/essential/45898_rest_api_get_client_properties.html

 

But, unfortunately, I can’t seem to find a more granular result.

 

Like for example, I’ve used Get /Client/VMPseudoClient API, Get VMBrowse (but unable to find PseudoClientId and inventoryPath) ang Get ClientID (but I am also getting clients that were unlicensed already) but all operations does not give me the information I need.

 

I need to get the VM subclients under active VSA Agent and also FS clients that are currently licensed and being backed up. 

 

Do you guys have any sample that I can refer to? Thanks a bunch! 

icon

Best answer by bish 26 October 2021, 02:34

View original

9 replies

Userlevel 6
Badge +14

Hi @FroiV 

I don’t think there is a granular way to obtain the results you’re looking for, you will need to collect the response and then programmatically inspect the results to filter on only the desired clients.

 

You can use GET /Client/VMPseudoClient to return a list of those pseudo clients, if you can narrow down the results to the expected types, this will help identify the clients you’re looking for.

For example, if you know you’re looking for a VMware client, this will be found in the results with VSInstanceType=1.

VSInstanceType

 The type of hypervisor instance.

Valid values are:

  • 0, for none

  • 1, for VMware

  • 2, for Hyper-V

  • 3, for Citrix Xen

  • 4, for Amazon

  • 5, for Microsoft Azure Classic

  • 6, for Red Hat Enterprise Virtualization (RHEV)

  • 7, for Microsoft Azure Resource Manager

  • 9, for Nutanix Acropolis Hypervisor (AHV)

  • 10, for Oracle VM

  • 11, for Docker

  • 12, for OpenStack

  • 13, for Oracle Cloud Infrastructure Classic

  • 14, for Huawei FusionCompute

  • 15, for vCloud Director

  • 16, for Google Cloud Platform

  • 17, for Microsoft Azure Stack Hub

  • 19, for Oracle Cloud Infrastructure Classic

VSPseudoClientsList

clientName and clientId are also returned in the response, so you can use these to perform either:

GET /Subclient?clientId={clientId}

GET /Subclient?clientName={clientName}

 

Get Client Properties also has a response item IsVirtualClient=true/false

GET /Client/{clientId}

IsVirtualClient

Valid values are True/False.

clientProps

Get Client Properties

 

For FileSystem, you could use GET Subclient Properties and check the response for:

GET /Subclient/{subcilentId}

applicationId

The ID of the application.

Valid values are:

  • 53, for Exchange Database

  • 33, for File System

  • 104, for MySQL

  • 13, for NAS

  • 59, for Notes Database

  • 22, for Oracle

  • 80, for Oracle RAC

  • 125, for PostgreSQL

  • 79, for SAP for MAX DB

  • 61, for SAP for Oracle

  • 81, for SQL Server

  • 5, for Sybase Database

  • 106, Virtual Server

subClientEntity

applicationId=33

enableBackup=true

GET Subclient Properties

 

Thanks,

Stuart

 

Userlevel 3
Badge +3

Just to add to the great detail provided by Stuart….

I’m not sure of the level of detail you need but you can get reasonable details for all Subclients of an app type under FR24 using  clientId=0 in the following with PropertyLevel=20. Adjust the applicationID to suit

GET /Subclient?clientId=0&applicationId=106&PropertyLevel=20&includeVMPseudoSubclients=false

 

 

Does that provide the level of information you need or is it something more/less than that?

Badge +1

Thank you for your answers, @Stuart Painter @bish . I’m very new to scripting and these are helpful to me.

 

However, one of the issue I had is when I also browse for a client that had their licenses reclaimed from Commvault, I can still extract them on the GetClient command. These are for FS backups. 

 

Any suggestions would be helpful? thanks! 

Userlevel 7
Badge +21

@FroiV , are you trying to filter out the deconfigured clients from your output?

@bish might be able to advise, depe3ndoing on your end goal.

Userlevel 3
Badge +3

If it’s a case of easily seeing what File Servers are configured, FR25 provides additional APIs aka /v4/ which returns a response that includes a “configured” value.

GET /v4/FileServers?additionalProperties=true

(Note, you do not need additionalProperties=true for the “Configured” value. Left it there as it might be useful to you for further info)

e.g.

{

  "fileServerCount": 13,

  "fileServers": [

    {

      "id": 2,

      "name": "v11srv",

      "displayName": "v11srv",

      "GUID": "644DB626-9762-4472-AD4F-B6A5367C0B0D",

      "configured": true,

      "type": "WINDOWS",

      "lastBackup": {

        "jobId": 376921,

        "status": "COMPLETED",

        "time": 1635195614,

        "lastSuccessfulBackup": 1634716815

      },

      "applicationSize": 55941392381,

      "plan": {

        "id": 0,

        "name": ""

      },

      "SLA": {

        "status": "MISSED_SLA",

        "reason": "No Schedule"

      },

      "status": "ONLINE",

 

There are also other /v4 APIs in FR25 which might be useful to you for information. Just calling them out in case they are ;)

GET /v4/VirtualMachines

GET /v4/Hypervisor

GET /v4/Databases

 

Hope that helps in some way.

Badge +1

If it’s a case of easily seeing what File Servers are configured, FR25 provides additional APIs aka /v4/ which returns a response that includes a “configured” value.

GET /v4/FileServers?additionalProperties=true

(Note, you do not need additionalProperties=true for the “Configured” value. Left it there as it might be useful to you for further info)

e.g.

{   "fileServerCount": 13,   "fileServers": [     {       "id": 2,       "name": "v11srv",       "displayName": "v11srv",       "GUID": "644DB626-9762-4472-AD4F-B6A5367C0B0D",       "configured": true,       "type": "WINDOWS",       "lastBackup": {         "jobId": 376921,         "status": "COMPLETED",         "time": 1635195614,         "lastSuccessfulBackup": 1634716815       },       "applicationSize": 55941392381,       "plan": {         "id": 0,         "name": ""       },       "SLA": {         "status": "MISSED_SLA",         "reason": "No Schedule"       },       "status": "ONLINE",

 

There are also other /v4 APIs in FR25 which might be useful to you for information. Just calling them out in case they are ;)

GET /v4/VirtualMachines

GET /v4/Hypervisor

GET /v4/Databases

 

Hope that helps in some way.

@bish thank you for this. just to clarify, what does FR25 means? I tried running this script and this is what I’ve got

cv_url is = http://apac-commserve.int.asurion.com:81/SearchSvc/CVWebService.svc/




Result:

:\Users\froilanjasper.vitug\AppData\Local\Programs\Python\Python37\python.exe "C:/Users/froilanjasper.vitug/Documents/Python Scripts/CV_Backup_Check_V3.py"
QFNVUmlvbjIzMjQyOSE=
Traceback (most recent call last):
  File "C:/Users/froilanjasper.vitug/Documents/Python Scripts/CV_Backup_Check_V3.py", line 51, in <module>
    result = list.json()
  File "C:\Users\froilanjasper.vitug\AppData\Local\Programs\Python\Python37\lib\site-packages\requests\models.py", line 910, in json
    return complexjson.loads(self.text, **kwargs)
  File "C:\Users\froilanjasper.vitug\AppData\Local\Programs\Python\Python37\lib\json\__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "C:\Users\froilanjasper.vitug\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\froilanjasper.vitug\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Process finished with exit code 1
 

Userlevel 3
Badge +3

Sorry, FR25 - Feature Release 25 for v11 

https://documentation.commvault.com/11.25/essential/134958_feature_release_1125.html

Badge +1

Do we have anything specific for SP20? we can’t upgrade the SP to 25 at the moment. 

Userlevel 3
Badge +3

I’ll check and come back to you.

Reply