Solved

API on client details

  • 11 November 2021
  • 3 replies
  • 86 views

Userlevel 1
Badge +6

Hi All,

 

I would like to ask for some better ideas than mine..

In particular I need information if client has it’s backup activity enabled/disabled on client level and if so, collect it’s commcell name as we have 2 commcells in our environment. Also, client shouldn’t be deleted (greyed out in Java GUI).

Here is the snippet of code to get the general idea for what I need.

    def check_config_on_client_level(self, cloud_vms):
"""This method will check if disabled for backups in cloud2 vm has backup enabled on client level in commvault"""

bad_client_level_config_vms = []

for api in self.cs_url:
api['headers']['Content-Type'] = 'application/json'
for vm in cloud_vms:
request = api['url'] + f"Client/byName(clientName='{vm['vm_name']}')"
response = requests.get(request, headers=api['headers'])
if response.status_code == 200:
client_details = response.json()
for vm_client_properties in client_details['clientProperties']:
if not vm_client_properties['clientProps']['IsDeletedClient']:
if vm_client_properties['clientProps']['activityControl']['EnableDataManagement']:
vm['Commcell'] = vm_client_properties['client']['clientEntity']['commCellName'].split(".", 1)
bad_client_level_config_vms.append(vm)
if response.status_code == 404:
print(f"{vm['vm_name']} was not found in either DK1 or DK2 commcells.")
return bad_client_level_config_vms

 

I am using API call: https://api.commvault.com/#bdeffba6-a436-04ff-b018-0b64864d48c9 (webconsole/api/Client/{{clientId}})

Problem with that is - I can only get details per 1 client..and let’s say I have 1.5K clients to run through - I am hitting CPU usage to the max (SQL process) on commserv.


I was thinking, would someone know if there is a view or some other table that contains such information in CommServ database, so I could query it directly to get all clients, instead of 1 by 1?

I am not good enough on joining tables, even if I would knew the tables I would need to join. I think I could manage it in the end, but would be nice if someone could share that sql query :)

Thanks All


UPDATE:

Found one view in CommServ DBm which works for agent based backups:

SELECT
[Client]
,[ClientStatus]
,[ClientBkpEnable]
,[ClientRstEnable]
FROM [CommServ].[dbo].[CommCellClientConfig] WHERE [ClientStatus] NOT LIKE '%Deleted%' AND [ClientStatus] NOT LIKE '%Uninstalled%' AND [ClientBkpEnable] NOT LIKE '%Yes%'



Problem is when you have clients which are VMs and are doing snapshot backups (being discovered) and does not have agent installed. In such case - above view is not working as it does not see those snapshotted VMs as clients.

I’ve found another view:
 

SELECT  
[ClientName]
,[DataProtActivity]
,[Status]
,[Description]
,[ClientType]
FROM [CommServ].[dbo].[CNClientInfoView]


But I am not sure what values in columns ‘DataProtActivity’ and ‘Status’ mean. Values 1, 2 are present for VM which is has backup activity enabled on client level - so I cannot differ..

icon

Best answer by Mike Struening 11 November 2021, 19:33

View original

3 replies

Userlevel 1
Badge +6

For some reason I cannot edit my post anymore, so commenting here..Possibly I’ve found a bug for SP24?

 



Usually and still on SP20 at least when client has it’s backups disabled on client level - you can see arrow near the icon that shows it’s disabled, now we cannot see it in above screenshots and maybe thus the status is ‘0’ in the CommServ DB itself?

 

 

Userlevel 1
Badge +6

OK, I think I found one view which helps for snapshot VMs, but still need to verify if it returns correct info:

 

SELECT  
[ClientName]
,[DataProtActivity]
,[Status]
,[Description]
,[ClientType]
FROM [CommServ].[dbo].[CNClientInfoView] where DataProtActivity = 1 and Status != 2

 

Userlevel 7
Badge +23

Thanks for the post!

I found an older document that covers the view:

https://documentation.commvault.com/commvault/release_9_0_0/books_online_1/english_us/features/commcell_explorer/commcell_explorer.htm

However, this does not clarify what 1 and 2, etc. mean.

I’ll reach out to our docs team and see what we have to provide.  I’m only seeing references to the view you tried at the top:

https://documentation.commvault.com/11.25/expert/5528_commcellclientconfig_01.html

Side note, you can only edit your posts for 30 minutes or so.

Reply