---
version: v1
display_name: AWS ELB (Classic)
namespace: AWS/ELB
query:
  period: 5m
instance:
  dimensions:
    - name: LoadBalancerName
      label: load_balancer_name
metrics:
  - id: request_count
    metric_name: RequestCount
    statistics: [sum]
    rate: true
  - id: http_code_backend_2xx
    metric_name: HTTPCode_Backend_2XX
    statistics: [sum]
    rate: true
  - id: http_code_backend_3xx
    metric_name: HTTPCode_Backend_3XX
    statistics: [sum]
    rate: true
  - id: http_code_backend_4xx
    metric_name: HTTPCode_Backend_4XX
    statistics: [sum]
    rate: true
  - id: http_code_backend_5xx
    metric_name: HTTPCode_Backend_5XX
    statistics: [sum]
    rate: true
  - id: http_code_elb_4xx
    metric_name: HTTPCode_ELB_4XX
    statistics: [sum]
    rate: true
  - id: http_code_elb_5xx
    metric_name: HTTPCode_ELB_5XX
    statistics: [sum]
    rate: true
  - id: backend_connection_errors
    metric_name: BackendConnectionErrors
    statistics: [sum]
    rate: true
  - id: latency
    metric_name: Latency
    statistics: [average]
  - id: healthy_host_count
    metric_name: HealthyHostCount
    statistics: [average]
  - id: unhealthy_host_count
    metric_name: UnHealthyHostCount
    statistics: [average]
  - id: spillover_count
    metric_name: SpilloverCount
    statistics: [sum]
    rate: true
  # ----------------------------------------------------------------------------------------
  # Opt-in metrics (disabled by default). Select them through rules[].metrics.
  # Both are published at the {LoadBalancerName} grain, so no other change is needed.
  # ----------------------------------------------------------------------------------------
  - id: surge_queue_length
    disabled: true
    metric_name: SurgeQueueLength
    statistics: [maximum]
  - id: desync_mitigation_noncompliant
    disabled: true
    metric_name: DesyncMitigationMode_NonCompliant_Request_Count
    statistics: [sum]
    rate: true
  # AWS also publishes EstimatedALB* metrics (ALB-migration sizing estimates, not operational). See:
  # https://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-cloudwatch-metrics.html
template:
  family: ELB
  context_namespace: elb
  chart_defaults:
    instances:
      by_labels: [account_id, region, load_balancer_name]
  charts:
    - id: aws_cloudwatch_elb_requests
      context: request_count
      title: ELB Request Count
      family: Requests
      units: requests/s
      algorithm: absolute
      dimensions:
        - selector: request_count_sum
          name: requests
    - id: aws_cloudwatch_elb_backend_response_codes
      context: backend_response_codes
      title: ELB Backend Response Codes
      family: Responses
      units: responses/s
      algorithm: absolute
      dimensions:
        - selector: http_code_backend_2xx_sum
          name: 2xx
        - selector: http_code_backend_3xx_sum
          name: 3xx
        - selector: http_code_backend_4xx_sum
          name: 4xx
        - selector: http_code_backend_5xx_sum
          name: 5xx
    - id: aws_cloudwatch_elb_elb_response_codes
      context: elb_response_codes
      title: ELB Load Balancer Response Codes
      family: Responses
      units: responses/s
      algorithm: absolute
      dimensions:
        - selector: http_code_elb_4xx_sum
          name: 4xx
        - selector: http_code_elb_5xx_sum
          name: 5xx
    - id: aws_cloudwatch_elb_backend_errors
      context: backend_connection_errors
      title: ELB Backend Connection Errors
      family: Errors
      units: errors/s
      algorithm: absolute
      dimensions:
        - selector: backend_connection_errors_sum
          name: errors
    - id: aws_cloudwatch_elb_latency
      context: latency
      title: ELB Latency
      family: Latency
      units: seconds
      algorithm: absolute
      dimensions:
        - selector: latency_average
          name: latency
    - id: aws_cloudwatch_elb_host_count
      context: host_count
      title: ELB Host Count
      family: Hosts
      units: hosts
      algorithm: absolute
      dimensions:
        - selector: healthy_host_count_average
          name: healthy
        - selector: unhealthy_host_count_average
          name: unhealthy
    - id: aws_cloudwatch_elb_spillover
      context: spillover_count
      title: ELB Spillover Count
      family: Queue
      units: events/s
      algorithm: absolute
      dimensions:
        - selector: spillover_count_sum
          name: spillover
    # ----------------------------------------------------------------------------------------
    # Charts for the opt-in metrics above.
    # ----------------------------------------------------------------------------------------
    - id: aws_cloudwatch_elb_surge_queue
      context: surge_queue_length
      title: ELB Surge Queue Length
      family: Queue
      units: requests
      algorithm: absolute
      dimensions:
        - selector: surge_queue_length_maximum
          name: queued
    - id: aws_cloudwatch_elb_desync
      context: desync_mitigation
      title: ELB Desync Mitigation Non-Compliant Requests
      family: Requests
      units: requests/s
      algorithm: absolute
      dimensions:
        - selector: desync_mitigation_noncompliant_sum
          name: noncompliant
