Modifying Alarm Triggering Policies

Last updated: 2020-06-04 16:17:58

    Note:

    This is a legacy API which has been hidden and will no longer be updated. We recommend using the new Auto Scaling API 3.0 which is standardized and faster.

    1. API Description

    This API (ModifyScalingPolicy) is used to modify alarm trigger policies.
    Domain for API request: scaling.api.qcloud.com

    1) When adjustmentType is TotalCapacity, it means adjusting the number of CVM instances in the current scaling group to the number specified by adjustmentValue. The value of adjustmentValue must be greater than or equal to 0.

    2) When adjustmentType is QuantityChangeInCapacity or PercentChangeInCapacity, if the value of adjustmentValue is positive, it means increasing instances, and if negative, it means reducing instances.

    3) When adjustmentType is PercentChangeInCapacity, adjustmentValue indicates the percentage of current instances.

    2. Input Parameters

    The following request parameter list only provides API request parameters. Common request parameters need to be added when the API is called. For more information, refer to Common Request Parameters. The Action field for this API is ModifyScalingPolicy.

    Parameter Name Required Type Description
    scalingGroupId Yes String ID of the scaling group for which the alarm trigger policy needs to be modified. It can be queried by calling API Query Scaling Group List (DescribeScalingGroup).
    scalingPolicyId Yes String ID of the alarm trigger policy; ID of the alarm trigger policy to be modified in this case. This parameter can be queried by calling API Query Alarm Trigger Policy (DescribeScalingPolicy).
    scalingPolicyName No String Name of the alarm policy defined by users.
    metric No String Parameter metric stipulates the specific scaling policy in json format.
    {"dimensionName":"cpu_usage","comparisonOperator":"Greater","threshold":50}
    If the CPU utilization is greater than 50%, the scaling behavior will be triggered to increase or decrease corresponding CVMs. Click here to view detailed statistical rules
    adjustmentType No String Adjustment method of the scaling rule. Only 3 values are available:
    TotalCapacity: Adjusting the number of instances in the current scaling group to the specified number.
    QuantityChangeInCapacity: Increasing or decreasing the instances by specified number.
    PercentChangeInCapacity: Increasing or decreasing instances by specified percentage.
    adjustmentValue No Int Adjustment value for the scaling rule. If it is negative, it means decreasing instances. The value ranges of adjustmentValue are as follows:
    TotalCapacity: 0-30
    QuantityChangeInCapacity: -30-30
    PercentChangeInCapacity: -100-100.
    cooldown No Int Cooldown period (in seconds), a period of time when the corresponding scaling group is locked after a scaling activity is completed. During this period, this scaling group cannot execute other scaling activities.

    Parameter metric stipulates the specific scaling policy in json format. Its parameters are as follows:

    Parameter Name Required Type Description
    comparisonOperator No String Comparison operator. Available values include:
    Greater: Greater than
    EqualOrGreater: Greater than or equal to
    Less: Less than.
    EqualOrLess: Less than or equal to.
    Equal: Equal.
    NotEqual: Not equal.
    dimensionName No String Dimension. Available values include:
    cpu_usage: CPU utilization.
    mem_usage: Memory usage.
    lan_outtraffic: Outbound bandwidth of the private network.
    lan_intraffic: Inbound bandwidth of the private network.
    threshold No Int Alarm threshold:
    cpu_usage: value range [0, 100], unit: %
    mem_usage: value range [0, 100], unit: %
    lan_outtraffic: value range >0, unit: Bps
    lan_intraffic: value range >0, unit: Bps

    3. Output Parameters

    Parameter Name Type Description
    code Int Common error code; 0: Succeeded; other values: Failed. For more information, please refer to Common Error Codes on the Error Code page.
    message String Module error message description depending on API.
    codeDesc String Error code at business side. If the task succeeds, it will return "Success"; if the task fails, the specific business error reason will be returned.

    4. Error Codes

    The following error codes only include the business logic error codes for this API. For additional common error codes, refer to AS Error Code.

    Error Code Description
    InvalidParameter.MetricError METRIC is configured incorrectly
    InvalidParameter.ScalingPolicyAdjustmenttypeError Incorrect type of scaling action
    InvalidParameter.ScalingPolicyNameError Wrong scaling policy name
    InvalidParameter.AdjustmentValue adjustmentValue of scaling policy is beyond the range
    Conflict.ModifyDefaultScalingPolicyError Default policy cannot be edited

    5. Example

    https://scaling.api.qcloud.com/v2/index.php?
    &<Common request parameters>
    &scalingGroupId=xxxx
    &scalingPolicyId=xxxx
    &scalingPolicyName=xxxx
    &adjustmentType=QuantityChangeInCapacity
    &adjustmentValue=10
    &cooldown=300
    &metric={"dimensionName":"cpu_usage","comparisonOperator":"Greater","threshold":50}
    &notifyIds.0=1832
    &notifyIds.1=1833

    Example of returned result is as below:

    {
        "code":"0",
        "message":"",
        "codeDesc":"Success"   
    }

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback
    Help