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..