Module netapp_ontap.resources.counter_table

Copyright © 2023 NetApp Inc. All rights reserved.

This file has been automatically generated based on the ONTAP REST API documentation.

Overview

The Counter Manager subsystem allows both manual and automated processes to access statistical information about various aspects of the ONTAP system. The information is most often utilized to assess the current performance of the system.

The data architecture is broken down into four components:

  • Tables
  • Rows
  • Counters / Properties
  • Aggregation

Tables

A table represents a collection of statistics that are grouped according to a common feature or function. An example counter manager table is for network adapters. This table would contain statistics related to the network adapter's performance such as the number of packets, rate of flow and error counters.

A table is described by its schema which includes a detailed description about the various statistics included, their format and their purpose.

The table catalog is a collection of all the statistical tables that the ONTAP REST interface supports, which can be queried to find information about a data point of interest.

Rows

Each table is populated with a list of rows. Each row is identified by a unique key and represents a specific statistical entity within the system. For example, a system may contain multiple network adapters that are represented by several records in the network adapter table.

Counter / Property

A counter is the basic 'numeric' statistical unit of the architecture.

A property is the basic 'string' statistical unit of the architecture.

Counter values can be organized as singular values or into multi-dimensional arrays. An array can be one or two dimensional; formatted as a list of label / value pairs. Addditional detail can be found in the "counter" model definition.

A table schema definition consists of multiple counters and properties.

Counters are classified according to their type. The available type options are the following:

  • average
  • rate
  • raw
  • delta
  • percent

Average and percent counters specify a secondary counter called the 'denominator' in the schema. The client must use the provided and secondary counters to compute the final intended value.

For example:

from netapp_ontap import HostConnection
from netapp_ontap.resources import CounterRow

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = CounterRow("qos_detail", id="<instance-id>")
    resource.get(fields="counters", **{"counters.name": "visits|wait_time"})
    print(resource)

Note: In the above example, the average is calculated since boot-time. Sample periods are discussed in more detail below.

Counter Computations

The statistics available through the counter tables gives you information about a specific point in time. This data can be useful, but more often you are interested in the statistics over a period of time.

The procedure for calculating a statistic over a period of time involves the following:

  • Collect a data sample at the beginning of the period. If the counter requires a denominator, this should be collected at the same time.
  • Collect a second data sample at the end of the period. If the counter requires a denominator, collect a second sample at the same time.
  • Calculate the final result using the collected information and the formula associated with the counter type below

Note: All counters that are not of type 'raw' will require some computation to be useful.

-------------------
T1, T2 : The start and ending time of the sample period
C1, C2 : The counter value at the start and ending time of the period
D1, D2 : The denominator value at the start and ending time of the period
-------------------
Percentage = ((C2 - C1) x 100) / (D2 - D1)
Rate = (C2 - C1) / (T2 - T1)
Average = (C2 - C1) / (D2 - D1)
Delta = C2 - C1
-------------------

Aggregation

An aggregation is a logical container that consolidates the information from multiple entities into a single entity. There are two methods of aggregating tables:

  • Automatic
  • Combination.

Automatic

Tables with automatic aggregation are generated by consolidating all entities with matching identifiers. The underlying tables that contribute to the aggregated table are referenced by the following syntax: {table_name}:constituent.

Combination

Tables with combination aggregation are generated by consolidating all entities according to a unique field in the definition. The name of the combination table uses the following syntax: {table name}:{aggregation_name}.

An example combination table is 'volume:svm' table. This table aggregates all the volume statistics associated with a given vserver into a single table.

Multi-Dimensional Arrays

Numeric counters can be scalar, one-dimensional or two dimensional values. Scalars are the most common values which consist of a single numeric value. A one-dimensional array is commonly used to present histograms such as the following table:

< 1s     :  3
< 5s     : 10
< 60s    :  1

A counter endpoint response that contains the above table would be formated as follows:

{
  "name": "Sample One-Dimensional Counter",
  "labels": [ "< 1s", "< 5s", "< 60s" ],
  "values": [3, 10, 1]
}

A two-dimensional array is used to report information about more complex relationships. An example data set is below:

              New      Used
-----------------------------
Car             1         2
Truck           3         4
Motorcycle      5         6

A counter endpoint response that contains the above table would be formated as follows:

{
  "name": "Sample Two-Dimensional Counter",
  "labels": [ "New", "Used" ],
  "counters": [
    {
      "label": "Car",
      "values": [1, 2]
    },
    {
      "label": "Truck",
      "values": [3, 4]
    },
    {
      "label": "Motorcycle",
      "values": [5, 6]
    }
  ]
}

Filtering / Querying

The counter endpoints adhere to the same behavior as other endpoints, with exception of how queries are handled for nested array fields.

The default behavior when processing a nested array query is to return the entire array content on a match. The counter endpoints' behavior will only return entries in the array that match the query.

Counter responses can contain a significant amount of data. This behavior improves the response by only returning the information requested and eliminating extra work for the client.

For example:

Given the following array:
  "list": [ "fruit_apple", "color_red" ]
When you apply the following query:
  list=fruit*
The default query behavior will return the array as:
  "list": [ "fruit_apple", "color_red" ]
The counter endpoints will return the array as:
  "list": [ "fruit_apple" ]


Examples

Retrieving a table schema definition

This example retrieves the table description and schema definition for the qos_detail table.


from netapp_ontap import HostConnection
from netapp_ontap.resources import CounterTable

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = CounterTable(name="qos_detail")
    resource.get(fields="*")
    print(resource)

CounterTable(
    {
        "counter_schemas": [
            {
                "unit": "none",
                "name": "in_latency_path",
                "type": "raw",
                "description": "Determines whether or not service center-based statistics are in the latency path.",
            },
            {
                "unit": "none",
                "name": "node.name",
                "type": "string",
                "description": "System node name",
            },
            {
                "unit": "none",
                "name": "resource.name",
                "type": "string",
                "description": "Name of the associated resource.",
            },
            {
                "unit": "microsec",
                "denominator": {"name": "visits"},
                "name": "service_time",
                "type": "average",
                "description": "The workload's average service time per visit to the service center.",
            },
            {
                "unit": "per_sec",
                "name": "visits",
                "type": "rate",
                "description": "The number of visits that the workload made to the service center; measured in visits per second.",
            },
            {
                "unit": "microsec",
                "denominator": {"name": "visits"},
                "name": "wait_time",
                "type": "average",
                "description": "The workload's average wait time per visit to the service center.",
            },
        ],
        "name": "qos_detail",
        "description": "The qos_detail table that provides service center-based statistical information. Note: This table returns a large number of rows. Querying by row name and using wild cards may improve response times.",
        "_links": {"self": {"href": "/api/cluster/counter/tables/qos_detail"}},
    }
)


Query for tables that contain a keyword in the description

This example retrieves all table definitions contain the word "security" in their description.


from netapp_ontap import HostConnection
from netapp_ontap.resources import CounterTable

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    print(
        list(
            CounterTable.get_collection(
                fields="name,description", description="*security*"
            )
        )
    )

[
    CounterTable(
        {
            "name": "csm_global",
            "description": "This table reports global statistics of the Cluster Session Manager. The counters report the processing overhead of SpinNP cryptography, both encryption and decryption, as carried out by CSM as it handles cross-cluster data traffic, mostly on behalf of their data protection operations. For example, a customer might seek to know the processor time being consumed by these cryptographic operations in support of their cross-cluster traffic. That data might help them evaluate the performance impact of these security operations.",
            "_links": {"self": {"href": "/api/cluster/counter/tables/csm_global"}},
        }
    ),
    CounterTable(
        {
            "name": "file_directory",
            "description": "This table reports how many times file-directory jobs were triggered to the set the file-security ACLS or SLAG ACLS. This counter gives an indication how frequently the feature is being used to set the ACLS on file-directory/volume.",
            "_links": {"self": {"href": "/api/cluster/counter/tables/file_directory"}},
        }
    ),
]


Query for a specific property within all table rows.

This example requests the property named 'node.name' for all 'wafl' table rows.

Note: The properties array content excludes any entries that do not match the provided query.


from netapp_ontap import HostConnection
from netapp_ontap.resources import CounterRow

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    print(
        list(
            CounterRow.get_collection(
                "wafl", fields="properties", **{"properties.name": "node.name"}
            )
        )
    )

[
    CounterRow(
        {
            "_links": {
                "self": {"href": "/api/cluster/counter/tables/wafl/rows/<instance id>"}
            },
            "id": "<instance id>",
            "properties": [{"name": "node.name", "value": "<node name>"}],
        }
    )
]


Query for a list of properties that match a wildcard on a specific row.

This example queries for all properties associated with a row of the volume table.

Note: The properties array content excludes any entries that do not match the provided query.


from netapp_ontap import HostConnection
from netapp_ontap.resources import CounterRow

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = CounterRow("volume", id="<instance-id>")
    resource.get(fields="properties", **{"properties.name": "svm*"})
    print(resource)

CounterRow(
    {
        "counter_table": {"name": "volume"},
        "_links": {
            "self": {"href": "/api/cluster/counter/tables/volume/rows/<instance-id>/"}
        },
        "id": "<instance-id>",
        "properties": [
            {"name": "svm.name", "value": "<svm-name>"},
            {"name": "svm.uuid", "value": "4774d11c-a606-11ec-856f-005056bb7b59"},
        ],
    }
)


Query for a list of counters in a specific table row

This example queries for an explicit list of counters within a single row of the wafl table.

Note: The counters array content excludes any entries that do not match the provided query.


from netapp_ontap import HostConnection
from netapp_ontap.resources import CounterRow

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = CounterRow("wafl", id="<instance-id>")
    resource.get(fields="counters", **{"counters.name": "memory_used|memory_free"})
    print(resource)

CounterRow(
    {
        "counter_table": {"name": "wafl"},
        "_links": {
            "self": {"href": "/api/cluster/counter/tables/wafl/rows/<instance-id>"}
        },
        "id": "<instance-id>",
        "counters": [
            {"name": "memory_used", "value": 541},
            {"name": "memory_free", "value": 786},
        ],
    }
)

Classes

class CounterTable (*args, **kwargs)

Information for a single counter table.

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

Returns a count of all CounterTable resources that match the provided query


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

Returns a collection of counter tables and their schema definitions.

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) -> Iterable[Resource]

Returns a collection of counter tables and their schema definitions.

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.

Methods

def get (self, **kwargs) -> NetAppResponse

Returns the information about a single counter table.

Learn more


Fetch the details of the object from the host.

Requires the keys to be set (if any). After returning, new or changed properties from the host will be set on the instance.

Returns

A NetAppResponse object containing the details of the HTTP response.

Raises

NetAppRestError: If the API call returned a status code >= 400

Inherited members

class CounterTableSchema (*, only: Union[Sequence[str], Set[str]] = None, exclude: Union[Sequence[str], Set[str]] = (), many: bool = False, context: Dict = None, load_only: Union[Sequence[str], Set[str]] = (), dump_only: Union[Sequence[str], Set[str]] = (), partial: Union[bool, Sequence[str], Set[str]] = False, unknown: str = None)

The fields of the CounterTable object

Ancestors

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

Class variables

counter_schemas: List[Counter] GET

Array of counter schema definitions.

description: str GET

Description of the table.

The links field of the counter_table.

name: str GET

Table name.