# An example scrape configuration for running Prometheus with Outscale.
# API credentials: access key (20 alphanumeric chars) and secret key (40 chars).
# See https://docs.outscale.com/en/userguide/Creating-an-Access-Key.html
scrape_configs:
  - job_name: 'prometheus'
    outscale_sd_configs:
      - # region defaults to eu-west-2 if omitted.
        region: eu-west-2
        access_key: A1B2C3D4E5F6G7H8I9J0
        secret_key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    relabel_configs:
      # Only scrape targets whose Name tag value contains 'prometheus'.
      - source_labels: [__meta_outscale_vm_tag_Name]
        regex: '.*prometheus.*'
        action: keep
      # Use the public IP and port 9090 to scrape the target.
      - source_labels: [__meta_outscale_vm_public_ip]
        target_label: __address__
        replacement: '$1:9090'
      # Add the region as label.
      - source_labels: [__meta_outscale_vm_region]
        target_label: outscale_region

  - job_name: 'node'
    outscale_sd_configs:
      - region: eu-west-2
        port: 9100
        access_key: A1B2C3D4E5F6G7H8I9J0
        # Configure one of secret_key or secret_key_file.
        secret_key_file: /etc/prometheus/outscale_secret_key
    relabel_configs:
      # Use private IP and node exporter port by default.
      - source_labels: [__meta_outscale_vm_private_ip]
        target_label: __address__
        replacement: '$1:9100'
