github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/website/content/tools/autoscaling/plugins/strategy/threshold.mdx (about)

     1  ---
     2  layout: docs
     3  page_title: 'Autoscaling Plugins: Threshold'
     4  description: The "threshold" strategy plugin uses metric value tiers to define scaling actions.
     5  ---
     6  
     7  # Threshold Strategy Plugin
     8  
     9  The `threshold` strategy defines a range of metric values with a lower and an
    10  upper bound, and an action to take when the current metric value is considered
    11  to be within bounds.
    12  
    13  Multiple tiers can be defined by declaring more than one `check` in the
    14  same scaling policy. If there is any overlap between the bounds, the [safest
    15  `check`][internals_check] will be used.
    16  
    17  ~> **Note:** When using the `threshold` strategy with multiple checks make sure
    18    they all have the same [`group`][policy_group] value, otherwise your target
    19    may not be able to scale down.
    20  
    21  ## Agent Configuration Options
    22  
    23  ```hcl
    24  strategy "threshold" {
    25    driver = "threshold"
    26  }
    27  ```
    28  
    29  ## Policy Configuration Options
    30  
    31  ```hcl
    32  policy {
    33    # ...
    34    check "high-memory-usage" {
    35      # ...
    36      group = "memory-usage"
    37  
    38      strategy "threshold" {
    39        upper_bound = 100
    40        lower_bound = 70
    41        delta       = 1
    42      }
    43    }
    44  
    45    check "low-memory-usage" {
    46      # ...
    47      group = "memory-usage"
    48  
    49      strategy "threshold" {
    50        upper_bound = 30
    51        lower_bound = 0
    52        delta       = -1
    53      }
    54    }
    55    # ...
    56  }
    57  ```
    58  
    59  - `lower_bound` `(float: <optional>)` - The minimum value a metric must have
    60    to be considered with bounds.
    61  
    62  - `upper_bound` `(float: <optional>)` - The maximum value a metric must have
    63    to be considered within bounds.
    64  
    65  - `delta` `(int: <optional>)` - Specifies the relative amount to add (positive
    66    value) or remove (negative value) from the current target count. Conflicts
    67    with `percentage` and `value`.
    68  
    69  - `percentage` `(float: <optional>)` - Specifies a percentage value by which
    70    the current count should be increased (positive value) or decreased (negative
    71    value). Conflicts with `delta` and `value`.
    72  
    73  - `value` `(int: <optional>)` - Specifies an absolute value that should be set
    74    as the new target count. Conflicts with `delta` and `percentage`.
    75  
    76  - `within_bounds_trigger` `(int: 5)` - The number of data points in the query
    77    result time series that must be within the bound values to trigger the
    78    action.
    79  
    80  At least one of `lower_bound` or `upper_bound` must be defined. If
    81  `lower_bound` is not defined, any value below `upper_bound` is considered
    82  within bounds. Similarly, if `upper_bound` is not defined, any value above
    83  `lower_bound` will be considered within bounds.
    84  
    85  One, and only one, of `delta`, `percentage`, or `value` must be defined.
    86  
    87  [internals_check]: /tools/autoscaling/internals/checks
    88  [policy_group]: /tools/autoscaling/policy#group