CustomMetric

class oci.autoscaling.models.CustomMetric(**kwargs)

Bases: oci.autoscaling.models.metric_base.MetricBase

Metric details for triggering an autoscaling action based on a custom MQL query.

Attributes

METRIC_SOURCE_COMPUTE_AGENT str(object=’’) -> str
METRIC_SOURCE_CUSTOM_QUERY str(object=’’) -> str
metric_compartment_id [Required] Gets the metric_compartment_id of this CustomMetric.
metric_source Gets the metric_source of this MetricBase.
namespace [Required] Gets the namespace of this CustomMetric.
pending_duration Gets the pending_duration of this MetricBase.
query [Required] Gets the query of this CustomMetric.
resource_group Gets the resource_group of this CustomMetric.

Methods

__init__(**kwargs) Initializes a new CustomMetric object with values from keyword arguments.
get_subtype(object_dictionary) Given the hash representation of a subtype of this class, use the info in the hash to return the class of the subtype.
METRIC_SOURCE_COMPUTE_AGENT = 'COMPUTE_AGENT'
METRIC_SOURCE_CUSTOM_QUERY = 'CUSTOM_QUERY'
__init__(**kwargs)

Initializes a new CustomMetric object with values from keyword arguments. The default value of the metric_source attribute of this class is CUSTOM_QUERY and it should not be changed. The following keyword arguments are supported (corresponding to the getters/setters of this class):

Parameters:
  • pending_duration (str) – The value to assign to the pending_duration property of this CustomMetric.
  • metric_source (str) – The value to assign to the metric_source property of this CustomMetric. Allowed values for this property are: “COMPUTE_AGENT”, “CUSTOM_QUERY”
  • query (str) – The value to assign to the query property of this CustomMetric.
  • namespace (str) – The value to assign to the namespace property of this CustomMetric.
  • resource_group (str) – The value to assign to the resource_group property of this CustomMetric.
  • metric_compartment_id (str) – The value to assign to the metric_compartment_id property of this CustomMetric.
static get_subtype(object_dictionary)

Given the hash representation of a subtype of this class, use the info in the hash to return the class of the subtype.

metric_compartment_id

[Required] Gets the metric_compartment_id of this CustomMetric. The OCID of the compartment containing the metrics.

Returns:The metric_compartment_id of this CustomMetric.
Return type:str
metric_source

Gets the metric_source of this MetricBase. Source of the metric data for creating the alarm used to trigger autoscaling actions.

The following values are supported:

  • COMPUTE_AGENT: CPU or memory metrics emitted by the Compute Instance Monitoring plugin.
  • CUSTOM_QUERY: A custom Monitoring Query Language (MQL) expression.

Allowed values for this property are: “COMPUTE_AGENT”, “CUSTOM_QUERY”, ‘UNKNOWN_ENUM_VALUE’. Any unrecognized values returned by a service will be mapped to ‘UNKNOWN_ENUM_VALUE’.

Returns:The metric_source of this MetricBase.
Return type:str
namespace

[Required] Gets the namespace of this CustomMetric. The namespace for the query.

Returns:The namespace of this CustomMetric.
Return type:str
pending_duration

Gets the pending_duration of this MetricBase. The period of time that the condition defined in the alarm must persist before the alarm state changes from “OK” to “FIRING” or vice versa. For example, a value of 5 minutes means that the alarm must persist in breaching the condition for five minutes before the alarm updates its state to “FIRING”; likewise, the alarm must persist in not breaching the condition for five minutes before the alarm updates its state to “OK.”

The duration is specified as a string in ISO 8601 format (PT10M for ten minutes or PT1H for one hour). Minimum: PT3M. Maximum: PT1H. Default: PT3M.

Returns:The pending_duration of this MetricBase.
Return type:str
query

[Required] Gets the query of this CustomMetric. The Monitoring Query Language (MQL) expression to evaluate for the alarm. The Alarms feature of the Monitoring service interprets results for each returned time series as Boolean values, where zero represents false and a non-zero value represents true. A true value means that the trigger rule condition has been met. The query must specify a metric, statistic, interval, and trigger rule (threshold or absence). Supported values for interval: 1m-60m (also 1h). You can optionally specify dimensions and grouping functions. Supported grouping functions: grouping(), groupBy().

Example of threshold alarm:

CpuUtilization[1m]{availabilityDomain=”cumS:PHX-AD-1”}.groupBy(availabilityDomain).percentile(0.9) > 85
Returns:The query of this CustomMetric.
Return type:str
resource_group

Gets the resource_group of this CustomMetric. The resource group for the query.

Returns:The resource_group of this CustomMetric.
Return type:str