PowerShell VM CSV Report


A customer via a colleague, Satinder Sharma, wanted to have a CSV output from Get-TintriVM. Their attempt was:

Get-TintriVM  | Export-Csv WS_inventory.csv

This does nothing.  After some experimentation and assistance from Dhruv Vermula, we have this:

Get-TintriVM | Select-Object {$_.vmware.name}, {$_.Uuid.UuId} | Export-csv vm2.csv

This works, but the columns are “$_.vmware.name” and “$_Uuid.Uuid”, which is not very friendly.  So I created created a small script, VmCsvReport, that is similar to a blog post “Obtain a VM CSV Report“.  This script creates nice columns; for example, “VM Name” instead of “$_.vmware.name” and creates a CSV file.

The script uses @{Expression} to create alias columns.

 $ex = @{Expression={$_.vmware.name};label="VM Name"},
       @{Expression={$_.stat.sortedstats.LatencyTotalMs};label="Total Latency"},
       @{Expression={$_.stat.sortedstats.LatencyNetworkMs};label="Network Latency"},
       @{Expression={$_.stat.sortedstats.LatencyStorageMs};label="Storage Latency"},
       @{Expression={$_.stat.sortedstats.LatencyDiskMs};label="Disk Latency"}

The output of Get-TintriVM is piped into Select-Object using the aliases in $ex.  Then $results is piped to the Export-Csv cmdlet to create a CSV file.  This could be done in one line, but I broke it up so that I could easily examine the output in debug.

$result = Get-TintriVM -TintriServer $conn | Select-Object $ex
$result | Export-Csv $csv_file

The specified VM information is in the CSV file which Excel can read quite easily.

Unfortunately, the columns are hard-coded in the script, because the PowerShell Toolkit does not have a cmdlet that maps the CSV download API.  I couldn’t suss-out a way to have configurable columns similar “Obtain a VM CSV Report“. If you know a way, please let me know.

Until next time,

– Rick –


GitHub API Python Examples Updated


The API python examples on the Tintri GitHub site have been updated.

The library, python_1_1.py has been updated to disable SSL warnings. To facilitate this, a new method, api_version(), has been added to the library. It replaces the /info GET invoke.

All the API python client examples have been updated to use the python_1_1.py library and api_version() method. Since api_version() returns the same values as /info, the change is minimal. Here is an example diff:

 - r = tintri.api_get(server_name, '/info')
 + r = tintri.api_version(server_name)
      json_info = r.json()
      product_name = json_info['productName']

A new API client example, set_qos_tgc_service_groups.py is now available. This example shows how to use the new QoS TGC Service Group APIs. With the new APIs, configuring QoS for Service Groups has been simplified. The blog, TGC Service Groups and QoS Redux discusses this new QoS example.


– Rick –

PowerShell 2.5 Toolkit Released


It has been a while since I have posted. While I’ve been on vacation and catching-up, my colleague was working on a new Tintri Automation Toolkit for PowerShell 2.5. Today it went up on Tintri’s support site for your downloading pleasure. If you haven’t visited the support site in a while, you’ll notice that it has changed. Once on the support download page, find “Tintri Automation Toolkit 2.5” and click on it. An information frame will appear on the right. Click on “Download MSI” to download the new toolkit.

The major features are:
• Upgrade VMstore(s) given the RPM file
• Configure appliance settings (Data IPs, DNS, Autosupport, Alerts)
• Configure Hypervisor Managers on a VMstore
• Set Service Group QoS
• Support for SyncVM File-Level-Restore
• Manage VMstores on a TGC
• Set quota on SMB shares
• Support for PowerCLI 6

A more information is on my Tintri blog. For me, the top 3 features are: Tintri command search, setting QoS in TGC Service Groups, and updating VMstores from a downloaded RPM file.

Let me know if you have questions, or have coded new scripts you want posted on our GitHub site.


– Rick –

Some API differences with Virtually Aware Flash Storage


Tintri has just announce the T5000 All-Flash series.  This means that customers that desire all-flash storage now can have it all: flash, and virtually aware storage (VAS).  I recently blogged about some API and UI changes.

I wanted to go into a little more detail about the API changes.  The All-Flash code snippet in the blog is from an updated appliance_info.py. All the python files in the  Tintri API GitHub repo were updated with a more common python location for easy script running.

As for dedupeFactor and cloneDedupeFactor in the DatastoreStat object discussion, I hope the tables below clarify.  The first table shows the responses when invoking the following APIs from a VMstore.

  • GET /v310/datastore
  • GET /v310/datastore/{uuid}/statsHistoric
  • GET /v310/datastore/{uuid}/statsRealtime
  • GET /v310/datastore/{uuid}/statsSummary
Responses from VMstore
Field All-Flash Hybrid (4.0) Hybrid (3.2)
dedupFactor Valid Valid Not Available
cloneDedupFactor 1.0 Valid Valid

As you know, Tintri Global Center (TGC) and VMstore have the share some above API endpoints, but the responses can be different. Here is the table for the TGC responses:

Responses from TGC
Field All-Flash Hybrid (4.0) Hybrid (3.2)
dedupFactor Valid Valid 1.0
cloneDedupFactor 1.0 Valid Valid

As you can see, invoking the APIs via a TGC masks the “Not Available” for a consistent return for all fields.

Until next time,

– Rick –

Orchestration and Tintri APIs


I’d like to point out two orchestration examples that are using Tintri APIs.

The first one is by Nick Colyer on vRrealize orchestration. Nick created vRealize workflows that use Tintri APIs.  The series of posts show workflows that create a Tintri session, obtain a Tintri VM UUID, and perform a Tintri snapshot.

The second by is by a company called Emitrom, which create an orchestrator call Integra.  David LaMotta of Emitrom created a workflow that backs-up a VM to the AWS.  He also did a workflow that restores the VM from the AWS.  These workflows use the Tintri PowerShell Toolkit which is imported into Integra which allows each PowerShell commandlet to be a command in Integra.

I hope you can make use of these examples in your admin environments,

– Rick –

Measuring Storage Usage the Easy Way


I posted a blog entry on the Tintri cooperate blog.  This is a change in the corporate blog style to allow more technical blog posts.  Please feel free to comment.

The blog entry discusses how to collect statistics for chargeback and/or showback.  A new collection statistics code example posted on our Tintri GitHub site is discussed in the blog post as well.

So check it out.,

– Rick –

Tintri Automation Toolkit 1.5 Released

The Tintri Automation Toolkit version 1.5 is now released.  The Automation Toolkit allows you to manage Tintri VMstore and TGC using PowerShell.  It can be obtained from Tintri Support download page under the “Download” tab, and you need a login.

The Automation Toolkit QuickStart Overview Guide can be downloaded from Tintri Support download page under the “User Guides” tab.  Scroll down to “3/2/2015 entry: “Tintri Automation Toolkit Quick Start Overview Guide”.  The guide lists all the PowerShell cmdlets, discusses how to get help and authentication, and has code samples.  See my previous PowerShell post for pictures on how to download.

The 1.5 version highlights are:

  • Hyper-V VM management
  • Delete Snapshot
  • SMB Share management
  • Support v310 Tintri API servers (as well as v300)
  • View datastore level statistics from TGC 1.1
  • On-line help improvements

Just like VMware VMs can be piped to Tintri cmdlets, so can Hyper-V VMs be piped to Tintri cmdlets.  This is what it means to be virtually aware storage.

Tintri Automation Toolkit examples are now being posted on GitHub.  Check-out the following examples that demonstrate the new features:

Over time, more PowerShell examples will be added, so check periodically.

Enjoy the new features,

– Rick –

Delete the Oldest Snapshot on a VMstore

Happy New Year,

For the beginning of the New Year, I have coded an REST API example in Python.  This example queries for the oldest user generated snapshot and removes it.  This example shows how to use a query string with the GET snapshot API invoke, and a DELETE snapshot.  What is cool about this example is that there are functions that encapsulate the requests Python modules calls that hopefully will be reusable.  I have attached the example, and will go through some of the code below.

First off, you will need these Python modules:

import requests
import json
import sys
from datetime import datetime

Let’s look at the login function.  A user name and password is all that is needed over HTTPS.

def api_login(server_name, user_name, password):
    # Payload, header and URL for login call
    headers = {'content-type': 'application/json'}
    payload = {'username': user_name,   # payload needed for post.
               'password': password,
               'typeId': 'com.tintri.api.rest.vcommon.dto.rbac.RestApiCredentials'}   # 'typeId' is required.
    url_login = 'https://'+ server_name + '/api/v310/session/login'

        # Invoke the login API.
        r = requests.post(url_login, data=json.dumps(payload),
        headers=headers, verify=False)
    except requests.ConnectionError:
        print_error("Login: API Connection error occurred")
    except requests.HTTPError:
        print_error("Login: HTTP error occurred")
    except requests.Timeout:
        print_error("Login: Request timed out")
        print_error("Login: An unexpected error " + sys.exc_info()[0] +
                    " occurred")

    # if HTTP Response is not 200 then raise an exception
    if r.status_code != 200:
        print_error("The HTTP response for login call to the server " +
                    server_name + " is not 200, but is: " + str(r.status_code))
        print_error("url = " + url_login)
        print_error("payload = " + str(payload))
        print_error("response: " + r.text)

    session_id = r.cookies['JSESSIONID']   # Session ID is return for subsequent invokes.
    return session_id

The info API does not require user name, password, or session ID.

r = api_get(server_name, '/api/info')
json_info = r.json()

The query below requests that the response returns the oldest user generated snapshot.

# Create filter to get the oldest user generated snapshot
q_filter = {'queryType': 'TOP_DOCS_BY_TIME',
'limit': '1', # There can only be one

# Get the oldest user generated snapshot
r = api_get_query(server_name, '/api/v310/snapshot', q_filter, session_id)

This example could be used for the basis of a snapshot delete program.  Additions could be added to the query string, like VM name or before this time.

The code example is here: delete_snapshot.


– Rick –

Tintri Announces VMstore T800 Series and Tintri OS 3.1


Today Tintri announced the VMstore T800 series with REST API support.  The T800 series currently has 3 models, T820, T850, and T880.  Tintri OS 3.1 is now available with public REST APIs.  Please see a previous post on how to download the documentation and code samples. Tintri OS 3.1 also includes vCenter SRM for automating disaster recovery and AES256 encryption on the media.


– Rick –

Tintri Releases REST API Documentation


Tintri first released the PowerShell Toolkit, and now Tintri has released API documentation so that clients are able to create applications and automation workflows to monitor and control Tintri’s virtual aware storage.

The REST API documentation for Tintri OS available on the Tintri support site.  To download it, go to http://support.tintri.com.  You will have to be a Tintri user and log-in.  First click on ‘Downloads’ in the blue rectangle, then click the ‘Utilities’ tab in the green rectangle.


Finally click on ‘Tintri REST API Documentation’ in the purple rectangle.  Save the zip file and unzip.  The zip file includes an introduction, specific API documentation, and code samples in Python.

Once unzipped, click on the api directory.  Inside the api directory, click on index.html, the Tintri APIs page.  From here, you can go to the REST API documentation and to the samples. The API documentation has an introduction and a list of the APIs with specific API documentation links..  The samples link points to an index which includes a small description of each sample and a link to the code. The Python code samples are located in api/client/http/sample/python.


– Rick –