Skip to content

get_container_service_metric_data

get_container_service_metric_data(
    service_name: ContainerServiceName,
    metric_name: ContainerServiceMetricName,
    start_time: IsoDate,
    end_time: IsoDate,
    period: MetricPeriod,
    statistics: MetricStatisticList,
    *,
    config_overrides: Optional[LightsailClientConfig] = None,
) -> GetContainerServiceMetricDataResult

Returns the data points of a specific metric of your Amazon Lightsail container service.

Metrics report the utilization of your resources. Monitor and collect metric data regularly to maintain the reliability, availability, and performance of your resources.

Parameters:

  • service_name (ContainerServiceName) –

    The name of the container service for which to get metric data.

  • metric_name (ContainerServiceMetricName) –

    The metric for which you want to return information.

    Valid container service metric names are listed below, along with the most useful statistics to include in your request, and the published unit value.

    • CPUUtilization - The average percentage of compute units that are currently in use across all nodes of the container service. This metric identifies the processing power required to run containers on each node of the container service.

      Statistics: The most useful statistics are Maximum and Average.

      Unit: The published unit is Percent.

    • MemoryUtilization - The average percentage of available memory that is currently in use across all nodes of the container service. This metric identifies the memory required to run containers on each node of the container service.

      Statistics: The most useful statistics are Maximum and Average.

      Unit: The published unit is Percent.

  • start_time (IsoDate) –

    The start time of the time period.

  • end_time (IsoDate) –

    The end time of the time period.

  • period (MetricPeriod) –

    The granularity, in seconds, of the returned data points.

    All container service metric data is available in 5-minute (300 seconds) granularity.

  • statistics (MetricStatisticList) –

    The statistic for the metric.

    The following statistics are available:

    • Minimum - The lowest value observed during the specified period. Use this value to determine low volumes of activity for your application.

    • Maximum - The highest value observed during the specified period. Use this value to determine high volumes of activity for your application.

    • Sum - All values submitted for the matching metric added together. You can use this statistic to determine the total volume of a metric.

    • Average - The value of Sum / SampleCount during the specified period. By comparing this statistic with the Minimum and Maximum values, you can determine the full scope of a metric and how close the average use is to the Minimum and Maximum values. This comparison helps you to know when to increase or decrease your resources.

    • SampleCount - The count, or number, of data points used for the statistical calculation.

Raises:

  • AccessDeniedException –

    Lightsail throws this exception when the user cannot be authenticated or uses invalid credentials to access a resource.

  • InvalidInputException –

    Lightsail throws this exception when user input does not conform to the validation rules of an input field.

    Domain and distribution APIs are only available in the N. Virginia (us-east-1) Amazon Web Services Region. Please set your Amazon Web Services Region configuration to us-east-1 to create, view, or edit these resources.

  • NotFoundException –

    Lightsail throws this exception when it cannot find a resource.

  • RegionSetupInProgressException –

    Lightsail throws this exception when an operation is performed on resources in an opt-in Region that is currently being set up.

  • ServiceException –

    A general service exception.

  • UnauthenticatedException –

    Lightsail throws this exception when the user has not been authenticated.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_lightsail/_services/lightsail.py
def get_container_service_metric_data(
    self,
    service_name: "capo_lightsail.types.container_service_name.ContainerServiceName",
    metric_name: "capo_lightsail.types.container_service_metric_name.ContainerServiceMetricName",
    start_time: "capo_lightsail.types.iso_date.IsoDate",
    end_time: "capo_lightsail.types.iso_date.IsoDate",
    period: "capo_lightsail.types.metric_period.MetricPeriod",
    statistics: "capo_lightsail.types.metric_statistic_list.MetricStatisticList",
    *,
    config_overrides: Optional[LightsailClientConfig] = None,
) -> "capo_lightsail.types.get_container_service_metric_data_result.GetContainerServiceMetricDataResult":
    """<p>Returns the data points of a specific metric of your Amazon Lightsail container service.</p> <p>Metrics report the utilization of your resources. Monitor and collect metric data regularly to maintain the reliability, availability, and performance of your resources.</p>

    Args:
        service_name: <p>The name of the container service for which to get metric data.</p>
        metric_name: <p>The metric for which you want to return information.</p> <p>Valid container service metric names are listed below, along with the most useful statistics to include in your request, and the published unit value.</p> <ul> <li> <p> <code>CPUUtilization</code> - The average percentage of compute units that are currently in use across all nodes of the container service. This metric identifies the processing power required to run containers on each node of the container service.</p> <p>Statistics: The most useful statistics are <code>Maximum</code> and <code>Average</code>.</p> <p>Unit: The published unit is <code>Percent</code>.</p> </li> <li> <p> <code>MemoryUtilization</code> - The average percentage of available memory that is currently in use across all nodes of the container service. This metric identifies the memory required to run containers on each node of the container service.</p> <p>Statistics: The most useful statistics are <code>Maximum</code> and <code>Average</code>.</p> <p>Unit: The published unit is <code>Percent</code>.</p> </li> </ul>
        start_time: <p>The start time of the time period.</p>
        end_time: <p>The end time of the time period.</p>
        period: <p>The granularity, in seconds, of the returned data points.</p> <p>All container service metric data is available in 5-minute (300 seconds) granularity.</p>
        statistics: <p>The statistic for the metric.</p> <p>The following statistics are available:</p> <ul> <li> <p> <code>Minimum</code> - The lowest value observed during the specified period. Use this value to determine low volumes of activity for your application.</p> </li> <li> <p> <code>Maximum</code> - The highest value observed during the specified period. Use this value to determine high volumes of activity for your application.</p> </li> <li> <p> <code>Sum</code> - All values submitted for the matching metric added together. You can use this statistic to determine the total volume of a metric.</p> </li> <li> <p> <code>Average</code> - The value of <code>Sum</code> / <code>SampleCount</code> during the specified period. By comparing this statistic with the <code>Minimum</code> and <code>Maximum</code> values, you can determine the full scope of a metric and how close the average use is to the <code>Minimum</code> and <code>Maximum</code> values. This comparison helps you to know when to increase or decrease your resources.</p> </li> <li> <p> <code>SampleCount</code> - The count, or number, of data points used for the statistical calculation.</p> </li> </ul>

    Raises:
        capo_lightsail.errors.access_denied_exception.AccessDeniedException: <p>Lightsail throws this exception when the user cannot be authenticated or uses invalid credentials to access a resource.</p>
        capo_lightsail.errors.invalid_input_exception.InvalidInputException: <p>Lightsail throws this exception when user input does not conform to the validation rules of an input field.</p> <note> <p>Domain and distribution APIs are only available in the N. Virginia (<code>us-east-1</code>) Amazon Web Services Region. Please set your Amazon Web Services Region configuration to <code>us-east-1</code> to create, view, or edit these resources.</p> </note>
        capo_lightsail.errors.not_found_exception.NotFoundException: <p>Lightsail throws this exception when it cannot find a resource.</p>
        capo_lightsail.errors.region_setup_in_progress_exception.RegionSetupInProgressException: <p>Lightsail throws this exception when an operation is performed on resources in an opt-in Region that is currently being set up.</p>
        capo_lightsail.errors.service_exception.ServiceException: <p>A general service exception.</p>
        capo_lightsail.errors.unauthenticated_exception.UnauthenticatedException: <p>Lightsail throws this exception when the user has not been authenticated.</p>
        capo_lightsail.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_lightsail.types.get_container_service_metric_data_request.GetContainerServiceMetricDataRequest]",
    ) -> OperationResponse[
        "capo_lightsail.types.get_container_service_metric_data_result.GetContainerServiceMetricDataResult"
    ]:
        import capo_lightsail._operations.lightsail_20161128.get_container_service_metric_data

        output, http_response = (
            capo_lightsail._operations.lightsail_20161128.get_container_service_metric_data.get_container_service_metric_data(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetContainerServiceMetricData")
    )
    input_: capo_lightsail.types.get_container_service_metric_data_request.GetContainerServiceMetricDataRequest = {
        "service_name": service_name,
        "metric_name": metric_name,
        "start_time": start_time,
        "end_time": end_time,
        "period": period,
        "statistics": statistics,
    }

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output