Module netapp_ontap.resources.performance_metric

Copyright © 2021 NetApp Inc. All rights reserved.

Overview

The Storage Aggregate Metrics API provides historical performance metrics for the specified aggregate. The collection GET operation retrieves read, write, other and total metrics for a given aggregate, in terms of IOPS, latency and throughput. The read and write categories display the I/O operations that service user reads and writes across all the hosted volumes on a given aggregate. The other category encompasses background I/O operations that implement data protection services currently running on the aggregate. IOPs are the number of I/O operations reported per second, throughput is the amount of I/O operations measured in bytes per second and latency is the average response time for an IOP, reported in microseconds. Without a specified time interval, the output is limited to statistics collected at 15 second intervals over the last hour.

Examples

Retrieving metrics for an aggregate

In this example, the API returns a set of records that exist for the aggregate with the given UUID for the last hour.

from netapp_ontap import HostConnection
from netapp_ontap.resources import PerformanceMetric

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    print(
        list(
            PerformanceMetric.get_collection(
                "538bf337-1b2c-11e8-bad0-005056b48388", max_records=4
            )
        )
    )

[
    PerformanceMetric({"timestamp": "2019-01-14T23:33:45+00:00"}),
    PerformanceMetric({"timestamp": "2019-01-14T23:33:30+00:00"}),
    PerformanceMetric({"timestamp": "2019-01-14T23:33:15+00:00"}),
    PerformanceMetric({"timestamp": "2019-01-14T23:33:00+00:00"}),
]

Retrieving metrics for an aggregate with a set timestamp

In this example, the API returns metric values for latency, IOPS, and throughput properties such as read, write and total. The status and duration for which the metrics are requested are also returned.

from netapp_ontap import HostConnection
from netapp_ontap.resources import PerformanceMetric

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    print(
        list(
            PerformanceMetric.get_collection(
                "538bf337-1b2c-11e8-bad0-005056b48388", timestamp="2019-01-1T23:33:00Z"
            )
        )
    )

[
    PerformanceMetric(
        {
            "latency": {"other": 0, "read": 148, "write": 216, "total": 199},
            "throughput": {"other": 0, "read": 6826, "write": 205892, "total": 212718},
            "timestamp": "2019-01-01T23:33:00+00:00",
            "duration": "PT15S",
            "status": "ok",
            "iops": {"other": 0, "read": 1, "write": 5, "total": 6},
        }
    )
]

Retrieving metrics for an aggregate for a set time interval

In this example, the API returns the requested metrics for the given time interval of 1 week. The interval value can be 1 hour, 1 day, 1 week, 1 month or 1 year. If the interval value is not set, a default value of 1 hour is used.

from netapp_ontap import HostConnection
from netapp_ontap.resources import PerformanceMetric

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    print(
        list(
            PerformanceMetric.get_collection(
                "538bf337-1b2c-11e8-bad0-005056b48388",
                return_timeout=15,
                fields="*",
                interval="1w",
                max_records=4,
            )
        )
    )

[
    PerformanceMetric(
        {
            "latency": {"other": 0, "read": 156, "write": 430, "total": 318},
            "throughput": {
                "other": 0,
                "read": 268328,
                "write": 5556255,
                "total": 5824584,
            },
            "timestamp": "2019-01-01T23:30:00+00:00",
            "duration": "PT30M",
            "status": "ok",
            "iops": {"other": 0, "read": 18, "write": 26, "total": 45},
        }
    ),
    PerformanceMetric(
        {
            "latency": {"other": 0, "read": 154, "write": 448, "total": 262},
            "throughput": {
                "other": 0,
                "read": 474266,
                "write": 6121908,
                "total": 6596175,
            },
            "timestamp": "2019-01-01T23:00:00+00:00",
            "duration": "PT30M",
            "status": "ok",
            "iops": {"other": 0, "read": 48, "write": 28, "total": 76},
        }
    ),
    PerformanceMetric(
        {
            "latency": {"other": 192, "read": 159, "write": 394, "total": 193},
            "throughput": {
                "other": 26244685,
                "read": 540164,
                "write": 2411356,
                "total": 29196206,
            },
            "timestamp": "2019-01-01T22:30:00+00:00",
            "duration": "PT30M",
            "status": "ok",
            "iops": {"other": 437, "read": 94, "write": 16, "total": 548},
        }
    ),
    PerformanceMetric(
        {
            "latency": {"other": 0, "read": 189, "write": 540, "total": 523},
            "throughput": {
                "other": 0,
                "read": 2842,
                "write": 2765407,
                "total": 2768249,
            },
            "timestamp": "2019-01-01T22:00:00+00:00",
            "duration": "PT30M",
            "status": "ok",
            "iops": {"other": 0, "read": 0, "write": 13, "total": 13},
        }
    ),
]

  • statistics aggregate show

Classes

class PerformanceMetric (*args, **kwargs)

Performance numbers, such as IOPS latency and throughput.

Initialize the instance of the resource.

Any keyword arguments are set on the instance as properties. For example, if the class was named 'MyResource', then this statement would be true:

MyResource(name='foo').name == 'foo'

Args

*args
Each positional argument represents a parent key as used in the URL of the object. That is, each value will be used to fill in a segment of the URL which refers to some parent object. The order of these arguments must match the order they are specified in the URL, from left to right.
**kwargs
each entry will have its key set as an attribute name on the instance and its value will be the value of that attribute.

Ancestors

Static methods

def count_collection(*args, connection: HostConnection = None, **kwargs) -> int

Retrieves historical performance metrics for an aggregate.

Learn more


Fetch a count of all objects of this type from the host.

This calls GET on the object to determine the number of records. It is more efficient than calling get_collection() because it will not construct any objects. Query parameters can be passed in as kwargs to determine a count of objects that match some filtered criteria.

Args

*args
Each entry represents a parent key which is used to build the path to the child object. If the URL definition were /api/foos/{foo.name}/bars, then to get the count of bars for a particular foo, the foo.name value should be passed.
connection
The HostConnection object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context.
**kwargs
Any key/value pairs passed will be sent as query parameters to the host. These query parameters can affect the count. A return_records query param will be ignored.

Returns

On success, returns an integer count of the objects of this type. On failure, returns -1.

Raises

NetAppRestError: If the API call returned a status code >= 400, or if there is no connection available to use either passed in or on the library.

def find(*args, connection: HostConnection = None, **kwargs) -> Resource

Retrieves historical performance metrics for an aggregate.

Learn more


Find an instance of an object on the host given a query.

The host will be queried with the provided key/value pairs to find a matching resource. If 0 are found, None will be returned. If more than 1 is found, an error will be raised or returned. If there is exactly 1 matching record, then it will be returned.

Args

*args
Each entry represents a parent key which is used to build the path to the child object. If the URL definition were /api/foos/{foo.name}/bars, then to find a bar for a particular foo, the foo.name value should be passed.
connection
The HostConnection object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context.
**kwargs
Any key/value pairs passed will be sent as query parameters to the host.

Returns

A Resource object containing the details of the object or None if no matches were found.

Raises

NetAppRestError: If the API call returned more than 1 matching resource.

def get_collection(*args, connection: HostConnection = None, max_records: int = None, **kwargs) -> typing.Iterable

Retrieves historical performance metrics for an aggregate.

Learn more


Fetch a list of all objects of this type from the host.

This is a lazy fetch, making API calls only as necessary when the result of this call is iterated over. For instance, if max_records is set to 5, then iterating over the collection causes an API call to be sent to the server once for every 5 records. If the client stops iterating before getting to the 6th record, then no additional API calls are made.

Args

*args
Each entry represents a parent key which is used to build the path to the child object. If the URL definition were /api/foos/{foo.name}/bars, then to get the collection of bars for a particular foo, the foo.name value should be passed.
connection
The HostConnection object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context.
max_records
The maximum number of records to return per call
**kwargs
Any key/value pairs passed will be sent as query parameters to the host.

Returns

A list of Resource objects

Raises

NetAppRestError: If there is no connection available to use either passed in or on the library. This would be not be raised when get_collection() is called, but rather when the result is iterated.

Inherited members

class PerformanceMetricSchema (*, only: typing.Union = None, exclude: typing.Union = (), many: bool = False, context: typing.Dict = None, load_only: typing.Union = (), dump_only: typing.Union = (), partial: typing.Union = False, unknown: str = None)

The fields of the PerformanceMetric object

Ancestors

  • netapp_ontap.resource.ResourceSchema
  • marshmallow.schema.Schema
  • marshmallow.base.SchemaABC

Class variables

duration GET

The duration over which this sample is calculated. The time durations are represented in the ISO-8601 standard format. Samples can be calculated over the following durations:

Valid choices:

  • PT15S
  • PT4M
  • PT30M
  • PT2H
  • P1D
  • PT5M
iops GET

The iops field of the performance_metric.

latency GET

The latency field of the performance_metric.

The links field of the performance_metric.

status GET

Errors associated with the sample. For example, if the aggregation of data over multiple nodes fails, then any partial errors might return "ok" on success or "error" on an internal uncategorized failure. Whenever a sample collection is missed but done at a later time, it is back filled to the previous 15 second timestamp and tagged with "backfilled_data". "Inconsistent_ delta_time" is encountered when the time between two collections is not the same for all nodes. Therefore, the aggregated value might be over or under inflated. "Negative_delta" is returned when an expected monotonically increasing value has decreased in value. "Inconsistent_old_data" is returned when one or more nodes do not have the latest data.

Valid choices:

  • ok
  • error
  • partial_no_data
  • partial_no_response
  • partial_other_error
  • negative_delta
  • not_found
  • backfilled_data
  • inconsistent_delta_time
  • inconsistent_old_data
  • partial_no_uuid
throughput GET

The throughput field of the performance_metric.

timestamp GET

The timestamp of the performance data.

Example: 2017-01-25T11:20:13.000+0000