stats_api#

class StatsApi(api_client=None)[source]#

Bases: object

get_entity_descriptors_v4(extId, _page=None, _limit=None, _filter=None, **kwargs)[source]#

Returns metadata information available for entity and metrics for given entities.

>>> response = api.get_entity_descriptors_v4(extId, (optional) _page, (optional) _limit, (optional) _filter)

This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True.

>>> thread = api.get_entity_descriptors_v4(extId, async_req=True)
>>> result = thread.get()
Parameters:
  • extId (str, required) – The UUID of a source.

  • _page (int) – A URL query parameter that specifies the page number of the result set. Must be a positive integer between 0 and the maximum number of pages that are available for that resource. Any number out of this range will lead to no results being returned.

  • _limit (int) – A URL query parameter that specifies the total number of records returned in the result set. Must be a positive integer between 1 and 100. Any number out of this range will lead to a validation error. If the limit is not provided a default value of 50 records will be returned in the result set.

  • _filter (str) – A URL query parameter that allows clients to filter a collection of resources. The expression specified with $filter is evaluated for each resource in the collection, and only items where the expression evaluates to true are included in the response. Expression specified with the $filter must conform to the OData V4.01 URL conventions. For example, filter ‘$filter=name eq ‘karbon-ntnx-1.0’ would filter result on cluster name karbon-ntnx1.0, filter ‘$filter=startswith(name, ‘C’)’ would filter on cluster name starting with C. The filter can be applied on the following fields: - entityType - metrics/name

  • kwargs

    kwargs for the method. The following can be passed for an asynchronous HTTP call:

    async_req=True
    

Returns:

An instance of class EntityDescriptorListApiResponse.

If the method is called asynchronously, returns the request thread.

get_entity_metrics_v4(sourceExtId, extId, _page=None, _limit=None, _startTime=None, _endTime=None, _samplingInterval=None, _statType=None, _filter=None, _orderby=None, **kwargs)[source]#

Returns a list of various attributes and metrics (time series data) that are available for a given entity type.

>>> response = api.get_entity_metrics_v4(sourceExtId, extId, (optional) _page, (optional) _limit, (optional) _startTime, (optional) _endTime, (optional) _samplingInterval, (optional) _statType, (optional) _filter, (optional) _orderby)

This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True.

>>> thread = api.get_entity_metrics_v4(sourceExtId, extId, async_req=True)
>>> result = thread.get()
Parameters:
  • sourceExtId (str, required) – The UUID of a source.

  • extId (str, required) – The UUID of an entity type.

  • _page (int) – A URL query parameter that specifies the page number of the result set. Must be a positive integer between 0 and the maximum number of pages that are available for that resource. Any number out of this range will lead to no results being returned.

  • _limit (int) – A URL query parameter that specifies the total number of records returned in the result set. Must be a positive integer between 1 and 100. Any number out of this range will lead to a validation error. If the limit is not provided a default value of 50 records will be returned in the result set.

  • _startTime (str) – The start time of the period for which stats should be reported. The value should be in extended ISO-8601 format. For example, start time of 2022-04-23T01:23:45.678+09:00 would consider all stats starting at 1:23:45.678 on the 23rd of April 2022. Details around ISO-8601 format can be found at https://www.iso.org/standard/70907.html

  • _endTime (str) – The end time of the period for which stats should be reported. The value should be in extended ISO-8601 format. For example, end time of 2022-04-23T013:23:45.678+09:00 would consider all stats till 13:23:45 .678 on the 23rd of April 2022. Details around ISO-8601 format can be found at https://www.iso.org/standard/70907.html

  • _samplingInterval (int) – The sampling interval in seconds at which statistical data should be collected For example, do you want performance statistics every 30 seconds? Every 60 seconds?

  • _statType (common.v1.stats.DownSamplingOperator) –

  • _filter (str) – A URL query parameter that allows clients to filter a collection of resources. The expression specified with $filter is evaluated for each resource in the collection, and only items where the expression evaluates to true are included in the response. Expression specified with the $filter must conform to the OData V4.01 URL conventions. For example, filter ‘$filter=name eq ‘karbon-ntnx-1.0’ would filter result on cluster name karbon-ntnx1.0, filter ‘$filter=startswith(name, ‘C’)’ would filter on cluster name starting with C. The filter can be applied on the following fields: - extId - metrics/name - metrics/timeSeries/values/value

  • _orderby (str) – A URL query parameter that allows clients to specify the sort criteria for the returned list of objects. Resources can be sorted in ascending order using asc or descending order using desc. If asc or desc are not specified the resources will be sorted in ascending order by default. For example, ‘$orderby=templateName desc’ would get all templates sorted by templateName in desc order. The orderby can be applied to the following fields: - extId

  • kwargs

    kwargs for the method. The following can be passed for an asynchronous HTTP call:

    async_req=True
    

Returns:

An instance of class EntityListApiResponse.

If the method is called asynchronously, returns the request thread.

get_entity_types_v4(extId, **kwargs)[source]#

Returns a list of available entity types and their UUIDs for a given source. These UUIDs can be used in other APIs to get entity metrics and descriptors.

>>> response = api.get_entity_types_v4(extId)

This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True.

>>> thread = api.get_entity_types_v4(extId, async_req=True)
>>> result = thread.get()
Parameters:
  • extId (str, required) – The UUID of a source.

  • kwargs

    kwargs for the method. The following can be passed for an asynchronous HTTP call:

    async_req=True
    

Returns:

An instance of class EntityTypeListApiResponse.

If the method is called asynchronously, returns the request thread.

get_sources_v4(**kwargs)[source]#

Returns a list of available sources and their UUIDs. These UUIDs can be used in other APIs to get entity types and their metrics.

>>> response = api.get_sources_v4()

This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True.

>>> thread = api.get_sources_v4(async_req=True)
>>> result = thread.get()
Parameters:

kwargs

kwargs for the method. The following can be passed for an asynchronous HTTP call:

async_req=True

Returns:

An instance of class SourceListApiResponse.

If the method is called asynchronously, returns the request thread.