Making 'lazy' great again!

  • 1 February 2021
  • 9 replies
  • 225 views

Badge +4

Hi folks,

 

I have a question and or rather willing to have a discussion and sharing information about how we can minimize our efforts of clicking. Possibly share scripts that we have developed and help each other out on daily tasks. We all know that Java GUI has a lot of ways to do the same and it also involves a lot of clicking. 

 

For example, I was able to find and adapt qscripts, qoperations and API for quite a few good daily ops in my scripts, automation:

  1. Get clients associated to specific Client Group;
  2. Get Client Group to which specific server belongs;
  3. Add / Remove client from specific Client Group
  4. Start / Stop media agents maintenance mode
  5. DIP’s operations (enable/disable/remove/add)
  6. Commcell activity (Enable/Disable)
  7. Finding duplicate clients between our commcells

 

And sure, all of it depends on the level of competence in automating, but Commvault being ‘old dinosaur’ can still be automated a bit. 

Now, for example I cannot find a way to write a script which switches preffered media agent from one to another in Storage Policy. Maybe someone has already done that? :)

 


9 replies

Badge

https://api.commvault.com/  this is the post man interface and rest Api documentation to  interface with commvault using this you should be able to  automate commvault using restapi.

Badge +4

https://api.commvault.com/  this is the post man interface and rest Api documentation to  interface with commvault using this you should be able to  automate commvault using restapi.

I do know this API page - and I am using it :) 

Userlevel 7
Badge +15

This reminds me of another great thread:

 

Great place to share tricks and tips!

Userlevel 5
Badge +9

Hi folks,

 

I have a question and or rather willing to have a discussion and sharing information about how we can minimize our efforts of clicking. Possibly share scripts that we have developed and help each other out on daily tasks. We all know that Java GUI has a lot of ways to do the same and it also involves a lot of clicking. 

 

For example, I was able to find and adapt qscripts, qoperations and API for quite a few good daily ops in my scripts, automation:

  1. Get clients associated to specific Client Group;
  2. Get Client Group to which specific server belongs;
  3. Add / Remove client from specific Client Group
  4. Start / Stop media agents maintenance mode
  5. DIP’s operations (enable/disable/remove/add)
  6. Commcell activity (Enable/Disable)
  7. Finding duplicate clients between our commcells

 

And sure, all of it depends on the level of competence in automating, but Commvault being ‘old dinosaur’ can still be automated a bit. 

Now, for example I cannot find a way to write a script which switches preffered media agent from one to another in Storage Policy. Maybe someone has already done that? :)

 

Great topic… Use Command Center and entity search bar… as an example:

“Disable commcell activity” requires  5 keystrokes and 1 click:

type “comm” in the entity search bar > tab

Click “activity control”

Get Client Group to which specific server belongs 4ish keystrokes and 1 click

type partial machine name until the hit shows > click hit

All server groups the machine is listed under is displayed

 

 

Your #7 is an interesting one.  For the same clients to be in multiple commcells, you are looking for multi-instanced machines?

Badge +4

Hi folks,

 

I have a question and or rather willing to have a discussion and sharing information about how we can minimize our efforts of clicking. Possibly share scripts that we have developed and help each other out on daily tasks. We all know that Java GUI has a lot of ways to do the same and it also involves a lot of clicking. 

 

For example, I was able to find and adapt qscripts, qoperations and API for quite a few good daily ops in my scripts, automation:

  1. Get clients associated to specific Client Group;
  2. Get Client Group to which specific server belongs;
  3. Add / Remove client from specific Client Group
  4. Start / Stop media agents maintenance mode
  5. DIP’s operations (enable/disable/remove/add)
  6. Commcell activity (Enable/Disable)
  7. Finding duplicate clients between our commcells

 

And sure, all of it depends on the level of competence in automating, but Commvault being ‘old dinosaur’ can still be automated a bit. 

Now, for example I cannot find a way to write a script which switches preffered media agent from one to another in Storage Policy. Maybe someone has already done that? :)

 

Great topic… Use Command Center and entity search bar… as an example:

“Disable commcell activity” requires  5 keystrokes and 1 click:

type “comm” in the entity search bar > tab

Click “activity control”

Get Client Group to which specific server belongs 4ish keystrokes and 1 click

type partial machine name until the hit shows > click hit

All server groups the machine is listed under is displayed

 

 

Your #7 is an interesting one.  For the same clients to be in multiple commcells, you are looking for multi-instanced machines?

Since we have multiple commcells, one for agent based clients, one for vcenter snapshots. When you have ~15K servers to manage, you are bound to have cases where the same client will be backed up in both commcells…

 

Also - we are not yet using command center, kind of prefer Java GUI. 

Userlevel 5
Badge +9

Hi folks,

 

I have a question and or rather willing to have a discussion and sharing information about how we can minimize our efforts of clicking. Possibly share scripts that we have developed and help each other out on daily tasks. We all know that Java GUI has a lot of ways to do the same and it also involves a lot of clicking. 

 

For example, I was able to find and adapt qscripts, qoperations and API for quite a few good daily ops in my scripts, automation:

  1. Get clients associated to specific Client Group;
  2. Get Client Group to which specific server belongs;
  3. Add / Remove client from specific Client Group
  4. Start / Stop media agents maintenance mode
  5. DIP’s operations (enable/disable/remove/add)
  6. Commcell activity (Enable/Disable)
  7. Finding duplicate clients between our commcells

 

And sure, all of it depends on the level of competence in automating, but Commvault being ‘old dinosaur’ can still be automated a bit. 

Now, for example I cannot find a way to write a script which switches preffered media agent from one to another in Storage Policy. Maybe someone has already done that? :)

 

Great topic… Use Command Center and entity search bar… as an example:

“Disable commcell activity” requires  5 keystrokes and 1 click:

type “comm” in the entity search bar > tab

Click “activity control”

Get Client Group to which specific server belongs 4ish keystrokes and 1 click

type partial machine name until the hit shows > click hit

All server groups the machine is listed under is displayed

 

 

Your #7 is an interesting one.  For the same clients to be in multiple commcells, you are looking for multi-instanced machines?

Since we have multiple commcells, one for agent based clients, one for vcenter snapshots. When you have ~15K servers to manage, you are bound to have cases where the same client will be backed up in both commcells…

 

Also - we are not yet using command center, kind of prefer Java GUI. 

 

I assume there are reasons this is stretched across commcells.  I’m not sure we can unpack that on the forums, but my guess is we would need to see where VM backup VS physical agent backup is being done across different CCIDs.  Interesting scenario, let me think about this.

 

Userlevel 3
Badge +3

Here are some possible solutions for your mentioned topics:

1. Get clients associated to specific Client Group;
https://documentation.commvault.com/commvault/v11/article?p=45844.htm
2. Get Client Group to which specific server belongs;
https://documentation.commvault.com/commvault/v11/article?p=45898.htm
3. Add / Remove client from specific Client Group
https://documentation.commvault.com/commvault/v11/article?p=45864.htm
4. Start / Stop media agents maintenance mode
Don't know if this is documented but it's a 

<?xml version="1.0" encoding="UTF-8"?><App_SetMediaAgentPropertiesReq>
    <mediaAgentInfo>
        <mediaAgent mediaAgentId="12345" mediaAgentName="myMediaAgentClientName"/>
        <mediaAgentProps markMAOfflineForMaintenance="1" enableMAAfterDelay="0"/>
    </mediaAgentInfo>
</App_SetMediaAgentPropertiesReq>

Pretty simple - set markMAOfflineForMaintenance to 1 for Maintenance Mode and 0 to turn it off again 

5. DIP’s operations (enable/disable/remove/add)

Example XML:
<?xml version="1.0" encoding="UTF-8"?><EVGui_SetArchPipeLineListForClientReq operationType="3">
    <ArchPipeLineList srcGroupId="0" destGroupId="0" isActive="1">
        <client1 id="2" name="10.10.100.1"/>
        <client2 id="5" name="10.10.100.3"/>
    </ArchPipeLineList>
</EVGui_SetArchPipeLineListForClientReq>

operationType would be 
ADD = 1
DELETE = 2
MODIFY = 3

6. Commcell activity (Enable/Disable)

<App_SetCommCellPropertiesReq>
    <commCellInfo>
        <commCellEntity _type_="1" commCellId="2" commCellName="commserve"/>
        <commCellActivityControlInfo>
            <activityControlOptions activityType="128" enableActivityType="0" enableAfterADelay="0" reason=""/>
        </commCellActivityControlInfo>
    </commCellInfo>
</App_SetCommCellPropertiesReq>

Set commCellName to the client name of your Commserve (the name of the top level node in the Commcell Browser)
enableActivityType would be 0 to disable, 1 to enable
activityType would be one of:
BACKUP=1,
RESTORE=2,
AUXCOP=4,
DRBACKUP=8,
ARCHIVEPRUNE=16,
MEDIARECYCLE=32,
SYNTHETICFULL=64,
ALLACTIVITY=128,
SCHEDULE=256,
ONLINECI=512,
OFFLINECI=1024,
DDBACTIVITY=2048,
DATAVERIFICATION=8192

7. Finding duplicate clients between our commcells

That's probably easiest to do with a metrics report that just looks for same client or net_hostname across the App_client tables of your attached Commcells - there is no API that goes across multiple Commcells

"Now, for example I cannot find a way to write a script which switches preffered media agent from one to another in Storage Policy"

You will need to use this XML: https://documentation.commvault.com/commvault/v11/article?p=14147_1.htm

 

 

Happy to help you with any automation questions :) 

Badge +4

 

"Now, for example I cannot find a way to write a script which switches preffered media agent from one to another in Storage Policy"

You will need to use this XML: https://documentation.commvault.com/commvault/v11/article?p=14147_1.htm

 

 

Happy to help you with any automation questions :) 

 

Maybe I have not been fully clear :)

When we do have patching - we patch odd/even media agents so we could stay operational - but this introduces us to the point where we have to go to ~8 Storage Policies and change from one media agent to other one to be preferable AND also to remove round robin and set it to ‘use preffered’.

Is this XML capable of doing it for multiple storage policies?

 

Userlevel 3
Badge +3

Hi Benjis,

the XML alone only does it for a single storage policy - I would just integrate this into some programmatic course of actions that a) determines the relevant storage policy copies b) runs a loop to switch them all.

A simple workflow with a ForEach Loop could do that.With a Commserve DB Query to determine all Storage Policy Copies having a default data path of “Media Agent 1” to switch them to “Media Agent 2” and then back again when run the next time.

A query like this (probably still al little rough around the edges but a good start) could give you all Storage Policies and their default Media Agent:

SELECT SP.name as StoragePolicy, 
       SP.id as StoragePolicyID,
       SPC.name as StoragePolicyCopy,
       SPC.id as StoragePolicyCopyID,
       C.name as MAForDefaultDataPath 
       from 
archGroup SP WITH(NOLOCK) INNER JOIN
archGroupCopy SPC WITH(NOLOCK) on SPC.archGroupId = SP.id INNER JOIN
MMDataPath DP WITH(NOLOCK) on DP.CopyId = SPC.archGroupId INNER JOIN
App_Client C WITH(NOLOCK) on DP.HostClientId = C.id
WHERE SP.id > 1 -- Do not show "CV_DEFAULT" Storage Policy (no SP assigned dummy object)
AND SP.type = 1 -- Do not show DR Storage Policies
AND (SP.flags & 8388608) = 0 -- Do not show Global Storage Policies
AND DP.flag & 1 > 0 -- Default Data Path

So you could then just use a Media Agent name (or ID) as Input Parameter for the Workflow and just switch all of the determined storage policies in a loop. 

Hope that helps :)

 

Reply