Skip to content

/AWS1/CL_CWT=>DESCRIBEALARMSFORMETRIC()

About DescribeAlarmsForMetric

Retrieves the alarms for the specified metric. To filter the results, specify a statistic, period, or unit.

This operation retrieves only standard alarms that are based on the specified metric. It does not return alarms based on math expressions that use the specified metric, or composite alarms that use the specified metric.

Method Signature

IMPORTING

Required arguments:

iv_metricname TYPE /AWS1/CWTMETRICNAME /AWS1/CWTMETRICNAME

The name of the metric.

iv_namespace TYPE /AWS1/CWTNAMESPACE /AWS1/CWTNAMESPACE

The namespace of the metric.

Optional arguments:

iv_statistic TYPE /AWS1/CWTSTATISTIC /AWS1/CWTSTATISTIC

The statistic for the metric, other than percentiles. For percentile statistics, use ExtendedStatistics.

iv_extendedstatistic TYPE /AWS1/CWTEXTENDEDSTATISTIC /AWS1/CWTEXTENDEDSTATISTIC

The percentile statistic for the metric. Specify a value between p0.0 and p100.

it_dimensions TYPE /AWS1/CL_CWTDIMENSION=>TT_DIMENSIONS TT_DIMENSIONS

The dimensions associated with the metric. If the metric has any associated dimensions, you must specify them in order for the call to succeed.

iv_period TYPE /AWS1/CWTPERIOD /AWS1/CWTPERIOD

The period, in seconds, over which the statistic is applied.

iv_unit TYPE /AWS1/CWTSTANDARDUNIT /AWS1/CWTSTANDARDUNIT

The unit for the metric.

RETURNING

oo_output TYPE REF TO /aws1/cl_cwtdscalrmsformetri01 /AWS1/CL_CWTDSCALRMSFORMETRI01

Domain /AWS1/RT_ACCOUNT_ID
Primitive Type NUMC

Examples

Syntax Example

This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.

DATA(lo_result) = lo_client->/aws1/if_cwt~describealarmsformetric(
  it_dimensions = VALUE /aws1/cl_cwtdimension=>tt_dimensions(
    (
      new /aws1/cl_cwtdimension(
        iv_name = |string|
        iv_value = |string|
      )
    )
  )
  iv_extendedstatistic = |string|
  iv_metricname = |string|
  iv_namespace = |string|
  iv_period = 123
  iv_statistic = |string|
  iv_unit = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  LOOP AT lo_result->get_metricalarms( ) into lo_row.
    lo_row_1 = lo_row.
    IF lo_row_1 IS NOT INITIAL.
      lv_alarmname = lo_row_1->get_alarmname( ).
      lv_alarmarn = lo_row_1->get_alarmarn( ).
      lv_alarmdescription = lo_row_1->get_alarmdescription( ).
      lv_timestamp = lo_row_1->get_alarmconfupdatedtsmp( ).
      lv_actionsenabled = lo_row_1->get_actionsenabled( ).
      LOOP AT lo_row_1->get_okactions( ) into lo_row_2.
        lo_row_3 = lo_row_2.
        IF lo_row_3 IS NOT INITIAL.
          lv_resourcename = lo_row_3->get_value( ).
        ENDIF.
      ENDLOOP.
      LOOP AT lo_row_1->get_alarmactions( ) into lo_row_2.
        lo_row_3 = lo_row_2.
        IF lo_row_3 IS NOT INITIAL.
          lv_resourcename = lo_row_3->get_value( ).
        ENDIF.
      ENDLOOP.
      LOOP AT lo_row_1->get_insufficientdataactions( ) into lo_row_2.
        lo_row_3 = lo_row_2.
        IF lo_row_3 IS NOT INITIAL.
          lv_resourcename = lo_row_3->get_value( ).
        ENDIF.
      ENDLOOP.
      lv_statevalue = lo_row_1->get_statevalue( ).
      lv_statereason = lo_row_1->get_statereason( ).
      lv_statereasondata = lo_row_1->get_statereasondata( ).
      lv_timestamp = lo_row_1->get_stateupdatedtimestamp( ).
      lv_metricname = lo_row_1->get_metricname( ).
      lv_namespace = lo_row_1->get_namespace( ).
      lv_statistic = lo_row_1->get_statistic( ).
      lv_extendedstatistic = lo_row_1->get_extendedstatistic( ).
      LOOP AT lo_row_1->get_dimensions( ) into lo_row_4.
        lo_row_5 = lo_row_4.
        IF lo_row_5 IS NOT INITIAL.
          lv_dimensionname = lo_row_5->get_name( ).
          lv_dimensionvalue = lo_row_5->get_value( ).
        ENDIF.
      ENDLOOP.
      lv_period = lo_row_1->get_period( ).
      lv_standardunit = lo_row_1->get_unit( ).
      lv_evaluationperiods = lo_row_1->get_evaluationperiods( ).
      lv_datapointstoalarm = lo_row_1->get_datapointstoalarm( ).
      lv_threshold = lo_row_1->get_threshold( ).
      lv_comparisonoperator = lo_row_1->get_comparisonoperator( ).
      lv_treatmissingdata = lo_row_1->get_treatmissingdata( ).
      lv_evaluatelowsamplecountp = lo_row_1->get_evaluatelowsamplectper00( ).
      LOOP AT lo_row_1->get_metrics( ) into lo_row_6.
        lo_row_7 = lo_row_6.
        IF lo_row_7 IS NOT INITIAL.
          lv_metricid = lo_row_7->get_id( ).
          lo_metricstat = lo_row_7->get_metricstat( ).
          IF lo_metricstat IS NOT INITIAL.
            lo_metric = lo_metricstat->get_metric( ).
            IF lo_metric IS NOT INITIAL.
              lv_namespace = lo_metric->get_namespace( ).
              lv_metricname = lo_metric->get_metricname( ).
              LOOP AT lo_metric->get_dimensions( ) into lo_row_4.
                lo_row_5 = lo_row_4.
                IF lo_row_5 IS NOT INITIAL.
                  lv_dimensionname = lo_row_5->get_name( ).
                  lv_dimensionvalue = lo_row_5->get_value( ).
                ENDIF.
              ENDLOOP.
            ENDIF.
            lv_period = lo_metricstat->get_period( ).
            lv_stat = lo_metricstat->get_stat( ).
            lv_standardunit = lo_metricstat->get_unit( ).
          ENDIF.
          lv_metricexpression = lo_row_7->get_expression( ).
          lv_metriclabel = lo_row_7->get_label( ).
          lv_returndata = lo_row_7->get_returndata( ).
          lv_period = lo_row_7->get_period( ).
          lv_accountid = lo_row_7->get_accountid( ).
        ENDIF.
      ENDLOOP.
      lv_metricid = lo_row_1->get_thresholdmetricid( ).
      lv_evaluationstate = lo_row_1->get_evaluationstate( ).
      lv_timestamp = lo_row_1->get_statetransedtimestamp( ).
    ENDIF.
  ENDLOOP.
ENDIF.