English

Cloud Insights API

Contributors netapp-alavoie dgracenetapp Download PDF of this topic

The Cloud Insights API enables NetApp customers and independent software vendors (ISVs) to integrate Cloud Insights with other applications, such as CMDB’s or other ticketing systems.

The Cloud Insights API is available in Cloud Insights Premium Edition.

Requirements for API Access

  • An API Access Token model is used to grant access.

  • API Token management is performed by Cloud Insights users with the Administrator role.

API Documentation (Swagger)

The latest API information is found by logging in to Cloud Insights and navigating to Admin > API Acccess. Click the API Documentation link.

API Documentation

The API Documentation is Swagger-based, which provides a brief description and usage information for the API, and allows you to try it out in your environment.

API Swagger Example

API Access Tokens

Before using the Cloud Insights API, you must create one or more API Access Tokens. Access tokens are used for specified API categories, and can grant read and/or write permissions. You can also set the expiration for each access token. All APIs under the specified categories are valid for the access token. Each token is void of a username or password.

To create an Access Token:

  • Click Admin > API Access

  • Click +API Access Token

    • Enter Token Name

    • Select API Categories

    • Specify the permissions granted for this API access

    • Specify Token Expiration

Your token will only be available for copying to the clipboard and saving during the creation process. Tokens can not be retrieved after they are created, so it is highly recommended to copy the token and save it in a secure location. You will be prompted to click the Copy API Access Token button before you can close the token creation screen.

You can disable, enable, and revoke tokens. Tokens that are disabled can be enabled.

Tokens grant general purpose access to APIs from a customer perspective; managing access to APIs in the scope of their own tenant. Customer administrators may grant and revoke these keys without direct involvement from Cloud Insights back end personnel.

The application receives an Access Token after a user successfully authenticates and authorizes access, then passes the Access Token as a credential when it calls the target API. The passed token informs the API that the bearer of the token has been authorized to access the API and perform specific actions specified by the scope that was granted during authorization.

The HTTP header where the Access Token is passed is X-CloudInsights-ApiKey:.

For example, use the following to retrieve storages assets:

curl https://<tenant_host_name>/rest/v1/assets/storages -H 'X-CloudInsights-ApiKey: <API_Access_Token>'

Where <API_Access_Token> is the token you saved during API access key creation.

API Categories

The Cloud Insights API is category-based, and currently contains the following categories:

  • ASSETS category contains asset, query, and search APIs.

    • Assets: Enumerate top-level objects and retrieve a specific object or an object hierarchy.

    • Query: Retrieve and manage Cloud Insights queries.

    • Import: Import annotations or applications and assign them to objects

    • Search: Locate a specific object without knowing the object’s unique ID or full name.

  • DATA_COLLECTION category is used to retrieve and manage data collectors.

Additional categories and/or APIs may become available over time. You can find the latest API information in the API Swagger documentation.

Inventory Traversal

This section describes how to traverse a hierarchy of Cloud Insights objects.

Top Level Objects

Individual objects are identified in requests by unique URL (called “self” in JSON) and require knowledge of object type and internal id. For some of the top level objects (Hosts, Storages, and so on), REST API provides access to the complete collection.

The general format of an API URL is:

https://<tenant>/rest/v1/<category>/<object>

For example, to retrieve all storages from a tenant named mysite.c01.cloudinsights.netapp.com, the request URL is:

https://mysite.c01.cloudinsights.netapp.com/rest/v1/assets/storages

Top level objects, such as Storage, can be used to traverse to other children and related objects. For example, to retrieve all disks for a specific storage, concatenate the storage “self” URL with “/disks”, for example:

https://<tenant>/rest/v1/assets/storages/4537/disks

Expands

Many API commands support the expand parameter, which provides additional details about the object or URLs for related objects.

The one common expand parameter is expands. The response contains a list of all available specific expands for the object.

For example, when you request the following:

https://<tenant>/rest/v1/assets/storages/2782?expand=_expands

The API returns all available expands for the object as follows:

expands example

Each expand contains data, a URL, or both. The expand parameter supports multiple and nested attributes, for example:

https://<tenant>/rest/v1/assets/storages/2782?expand=performance,storageResources.storage

Expand allows you to bring in a lot of related data in one response. NetApp advises that you do not request too much information at one time; this can cause performance degradation.

To discourage this, requests for top-level collections cannot be expanded. For example, you cannot request expand data for all storage objects at once. Clients are required to retrieve the list of objects and then choose specific objects to expand.

Performance Data

Performance data is gathered across many devices as separate samples. Every hour (the default), Cloud Insights aggregates and summarizes performance samples.

The API allows access to both the samples and the summarized data. For an object with performance data, a performance summary is available as expand=performance. Performance history time series are available through nested expand=performance.history.

Examples of Performance Data objects include:

  • StoragePerformance

  • StoragePoolPerformance

  • PortPerformance

  • DiskPerformance

A Performance Metric has a description and category and contains a collection of performance summaries. For example, Latency, Traffic, and Rate.

A Performance Summary has a description, unit, sample start time, sample end time, and a collection of summarized values (current, min, max, avg, etc.) calculated from a single performance counter over a time range (1 hour, 24 hours, 3 days, and so on).

API Performance Example

The resulting Performance Data dictionary has the following keys:

  • "self" is the object’s unique URL

  • “history” is the list of pairs of timestamp and map of counters values

  • Every other dictionary key (“diskThroughput” and so on) is the name of a performance metric.

Each performance data object type has a unique set of performance metrics. For example, the Virtual Machine performance object supports “diskThroughput” as a performance metric. Each supported performance metric is of a certain “performanceCategory” presented in the metric dictionary. Cloud Insights supports several performance metric categories listed later in this document. Each performance metric dictionary will also have the “description” field that is a human-readable description of this performance metric and a set of performance summary counter entries.

The Performance Summary counter is the summarization of performance counters. It presents typical aggregated values like min, max, and avg for a counter and also the latest observed value, time range for summarized data, unit type for counter and thresholds for data. Only thresholds are optional; the rest of attributes are mandatory.

Performance summaries are available for these types of counters:

  • Read – Summary for read operations

  • Write – Summary for write operations

  • Total – Summary for all operations. It may be higher than the simple sum of read and write; it may include other operations.

  • Total Max – Summary for all operations. This is the maximum total value in the specified time range.

Object Performance Metrics

The API can return detailed metrics for objects in your environment, for example:

  • Storage Performance Metrics such as IOPS (Number of input/output requests per second), Latency, or Throughput.

  • Switch Performance Metrics, such as Traffic Utilization, BB Credit Zero data, or Port Errors.

See the API Swagger documentation for information on metrics for each object type.

Performance History Data

History data is presented in performance data as a list of timestamp and counter maps pairs.

History counters are named based on the performance metric object name. For example, the virtual machine performance object supports “diskThroughput” so the history map will contain keys named “diskThroughput.read”, “diskThroughput.write” and “diskThroughput.total”.

Timestamp is in UNIX time format.

The following is an example of a performance data JSON for a disk:

Disk Performance JSON

Objects with Capacity Attributes

Objects with capacity attributes use basic data types and the CapacityItem for representation.

CapacityItem

CapacityItem is a single logical unit of capacity. It has “value” and “highThreshold” in units defined by its parent object. It also supports an optional breakdown map that explains how the capacity value is constructed. For example, the total capacity of a 100 TB storagePool would be a CapacityItem with a value of 100. The breakdown may show 60 TB allocated for “data” and 40 TB for “snapshots”.

Note

“highThreshold” represents system defined thresholds for the corresponding metrics, which a client can use to generate alerts or visual cues on values that are out of acceptable configured ranges.

The following shows the capacity for StoragePools with multiple capacity counters:

Storage Pool Capacity Example

Using Search to Look Up Objects

The search API is a simple entry point to the system. The only input parameter to the API is a free-form string and the resulting JSON contains a categorized list of results. Categories are different asset types from the Inventory, such as storages, hosts, dataStores, and so on. Each category would contain a list of objects of the category type that match the search criteria.

Cloud Insights is an extensible (wide open) solution that allows integrations with third party orchestration, business management, change control and ticketing systems as well as custom CMDB integrations.

Cloud Insight’s RESTful API and open MySQL database are primary points of integration that allow simple and effective movement of data and allow users to gain seamless access to their data.