---
version: v1
display_name: Amazon EFS
namespace: AWS/EFS
query:
  period: 5m
instance:
  dimensions:
    - name: FileSystemId
      label: file_system_id
metrics:
  - id: total_io_bytes
    metric_name: TotalIOBytes
    statistics: [sum]
    rate: true
  - id: data_read_io_bytes
    metric_name: DataReadIOBytes
    statistics: [sum]
    rate: true
  - id: data_write_io_bytes
    metric_name: DataWriteIOBytes
    statistics: [sum]
    rate: true
  - id: metadata_io_bytes
    metric_name: MetadataIOBytes
    statistics: [sum]
    rate: true
  - id: metered_io_bytes
    metric_name: MeteredIOBytes
    statistics: [sum]
    rate: true
  - id: permitted_throughput
    metric_name: PermittedThroughput
    statistics: [average]
  - id: percent_io_limit
    metric_name: PercentIOLimit
    statistics: [average]
  - id: burst_credit_balance
    metric_name: BurstCreditBalance
    statistics: [average]
  # ClientConnections has only the Sum statistic (a per-minute connection count), so it is queried at
  # a 60s period and presented as a count (not a per-second rate).
  - id: client_connections
    metric_name: ClientConnections
    statistics: [sum]
    query:
      period: 1m
    nil_as_zero: true   # Sum count; a quiet period is 0 client connections, not a gap
  # ----------------------------------------------------------------------------------------
  # Opt-in metrics (disabled by default). Select them through rules[].metrics.
  # Both are published at the {FileSystemId} grain.
  # ----------------------------------------------------------------------------------------
  - id: metadata_read_io_bytes
    disabled: true
    metric_name: MetadataReadIOBytes
    statistics: [sum]
    rate: true
  - id: metadata_write_io_bytes
    disabled: true
    metric_name: MetadataWriteIOBytes
    statistics: [sum]
    rate: true
  # StorageBytes uses the {FileSystemId, StorageClass} grain (15-min cadence) and TimeSinceLastSync the
  # {FileSystemId, DestinationFileSystemId} replication grain -- each needs its own profile. See:
  # https://docs.aws.amazon.com/efs/latest/ug/efs-metrics.html
template:
  family: EFS
  context_namespace: efs
  chart_defaults:
    instances:
      by_labels: [account_id, region, file_system_id]
  charts:
    - id: aws_cloudwatch_efs_io_throughput
      context: io_throughput
      title: EFS I/O Throughput
      family: Throughput
      units: bytes/s
      algorithm: absolute
      dimensions:
        - selector: total_io_bytes_sum
          name: total
        - selector: data_read_io_bytes_sum
          name: read
        - selector: data_write_io_bytes_sum
          name: write
        - selector: metadata_io_bytes_sum
          name: metadata
    - id: aws_cloudwatch_efs_metered_throughput
      context: metered_throughput
      title: EFS Metered vs Permitted Throughput
      family: Throughput
      units: bytes/s
      algorithm: absolute
      dimensions:
        - selector: metered_io_bytes_sum
          name: metered
        - selector: permitted_throughput_average
          name: permitted
    - id: aws_cloudwatch_efs_io_limit
      context: io_limit
      title: EFS Percent I/O Limit
      family: Limits
      units: percentage
      algorithm: absolute
      dimensions:
        - selector: percent_io_limit_average
          name: io_limit
    - id: aws_cloudwatch_efs_burst_credit
      context: burst_credit
      title: EFS Burst Credit Balance
      family: Credits
      units: bytes
      algorithm: absolute
      dimensions:
        - selector: burst_credit_balance_average
          name: balance
    - id: aws_cloudwatch_efs_client_connections
      context: client_connections
      title: EFS Client Connections
      family: Connections
      units: connections
      algorithm: absolute
      dimensions:
        - selector: client_connections_sum
          name: connections
    # ----------------------------------------------------------------------------------------
    # Charts for the opt-in metrics above.
    # ----------------------------------------------------------------------------------------
    - id: aws_cloudwatch_efs_metadata_io
      context: metadata_io
      title: EFS Metadata I/O
      family: Throughput
      units: bytes/s
      algorithm: absolute
      dimensions:
        - selector: metadata_read_io_bytes_sum
          name: read
        - selector: metadata_write_io_bytes_sum
          name: write
