With the rise of public cloud and pay-as-you-grow services, IT environments and data management workflows have changed dramatically. While the cloud brings a variety of benefits–cost savings, mobility, and stronger DR– it also comes with some scary challenges, such as maintaining a cost-efficient infrastructure and meeting retention SLAs.

Rubrik was built specifically to solve these challenges and is designed to protect and manage data, irrespective of where that data resides. We’re constantly talking to our customers so that we can continue to develop solutions that address their biggest pain points with cloud adoption.

Cloud Innovation Can Lead to Management Headaches 
While the cloud presents a multitude of benefits, managing multiple archival configurations and SLAs becomes tricky and often requires a number of tools. To help address this challenge and others, we’re thrilled to introduce rbkcli, a command line interface based on Rubrik APIs. This post walks through how to use a default rbkcli script that’s tailored to assist in managing Rubrik snapshots through APIs. This use case enables users to easily locate snapshots at massive scale within a single interface.

Before diving in, let’s go over the basics of rbkcli. All APIs available on Rubrik systems are also available as command lines in rbkcli, which you can install to run commands against your CDM remotely. rbkcli also extends Rubrik’s API functionality by allowing for customized scripts. Because of the dynamic and customizable nature of APIs, rbkcli is maintained as a community project by Rubrik Build in our GitHub space. Check out this quick start guide to learn more about rbkcli. 

With rbkcli, users can easily run a script across multiple resources and manage multiple clusters at one time. The example I’m going to discuss shows how to manage multiple archival locations.

When archiving data with Rubrik, once you have created your archival configuration, Rubrik will always obey your SLA retention parameter. However, suppose you want to  get rid of an archival location or stop and replace it with another location. To do this, you may want to confirm how many snapshots exist in a particular location and an estimate as to when they will be expired. For that, you can use the command rbkcli snapshot all.

rbkcli snapshot all
The goal is to find which snapshot Rubrik is storing in a particular archival location and when it will expire. To do this, start by getting all the snapshots for all objects in your Rubrik CDM and then filter the snapshots from a desired location. 

To get all the snapshots, simply run the command: rbkcli snapshots all. Note that this command loops a series of other APIs, so it can take awhile to get the results. Therefore, let’s store the output into a json file:

 

The command gathers all available APIs that can query for snapshots and then queries for all the objects in the Cluster. Once the list of objects is complete, it fetches the existing snapshots for each object. 

When returning the result of the snapshots, the script improves the API returned data with the name and ID of the parent object and a rough end-of-life date for that snapshot, which is resolved from the current SLA retention configuration.

Once the data is collected and the json file (all_snaps.json) is created, you can use other commands to filter the data according to your usage. The below command shows how to filter snaps that are in a particular archival location. To find out the archival location ID, use this command:

 

The bucket I want to check is the rubrikbucket1, which I can do with its ID 435aa0f7-bc57-4ee3-b665-2b8898c90c84

Now is the time to combine all gathered info into a custom report!  Let’s do so by using a rbkcli command that allows you to parse and filter any json file (rbkcli jsonfy) by running:

 

And there you go– you now have a clear list of snapshots and their parent object name, parent object type, SLA name, creation date, and expiration date.*

In case you need to provide that information to someone that is not technical or does not enjoy looking at the command line interface, you can generate an html report by running the following command: 

 

Once the command finishes, an html report file will be generated that is similar to this:

 

rbkcli allows you to generate the html table for any of the APIs Rubrik has available, plus any jSON file you provide to the  rbkcli jsonfy command.

You can also make use of rbkcli Gmail integration to send the report:

 

This will be the resulting email : 

*Caveats

  • The *estimate_expiration* is calculated based on the longest retention period set in an SLA. SLA retention configuration can be set to fewer snapshots overtime, therefore a snapshot might expire before the *estimate_expiration* but never after that time. 
  • Once there is no clear life-time per snapshot, the list returned should not be used to estimate space usage. Instead, it can show leftover snapshots in a location. With that information, you can determine when a location will stop being used by Rubrik after the archival location has been removed from the SLA configuration.
  • If you are using Azure Smart Tiering, the snapshots will have an additional field cloudStorageTier, which allows you to track snapshots in each tier.
  • Once rbkcli allows you to filter by any of the json keys returned with the snapshots APIs, you can tweak the command to return only one type of object or one SLA. It can be suited according to your needs.

For more information related to rbkcli json output selection, visit this page. For more information related to  rbkcli jsonfy  command,  visit this page.