Skip to content

Creates a scraper to collect metrics from Prometheus-compatible sources

Description

Creates a scraper to collect metrics from Prometheus-compatible sources. The scraper sends the collected metrics to Amazon Managed Service for Prometheus workspaces or CloudWatch datasets. You can configure scrapers to collect metrics from Amazon EKS clusters, Amazon MSK clusters, or from VPC-based sources that support DNS-based service discovery. Scrapers are flexible. You can configure a scraper to control which metrics to collect, the frequency of collection, which transformations to apply to the metrics, and more.

An IAM role will be created for you that Amazon Managed Service for Prometheus uses to access the metrics in your source. You must configure this role with a policy that allows it to scrape metrics from your source. For Amazon EKS sources, see Configuring your Amazon EKS cluster in the Amazon Managed Service for Prometheus User Guide.

The scrapeConfiguration parameter contains the base-64 encoded YAML configuration for the scraper.

When creating a scraper, the service creates a Network Interface in each Availability Zone that are passed into create_scraper through subnets. These network interfaces are used to connect to your source within the VPC for scraping metrics.

For more information about collectors, including what metrics are collected, and how to configure the scraper, see Using an Amazon Web Services managed collector in the Amazon Managed Service for Prometheus User Guide.

Usage

prometheusservice_create_scraper(alias, scrapeConfiguration, source,
  destination, roleConfiguration, clientToken, tags, exporters)

Arguments

  • alias

    (optional) An alias to associate with the scraper. This is for your use, and does not need to be unique.

  • scrapeConfiguration

    [required] The configuration file to use in the new scraper. For more information, see Scraper configuration in the Amazon Managed Service for Prometheus User Guide.

  • source

    [required] The Amazon EKS or Amazon Web Services cluster from which the scraper will collect metrics.

  • destination

    [required] The destination where the scraper sends the collected metrics. Valid destinations are Amazon Managed Service for Prometheus workspaces and CloudWatch datasets.

  • roleConfiguration

    Use this structure to enable cross-account access, so that you can use a target account to access Prometheus metrics from source accounts.

  • clientToken

    (Optional) A unique, case-sensitive identifier that you can provide to ensure the idempotency of the request.

  • tags

    (Optional) The list of tag keys and values to associate with the scraper.

  • exporters

    The exporter configurations for the scraper. You can configure at most one Amazon OpenSearch Service domain. If you don't specify a value, the scraper is created without an exporter configuration.

Value

A list with the following syntax:

list(
  scraperId = "string",
  arn = "string",
  status = list(
    statusCode = "CREATING"|"UPDATING"|"ACTIVE"|"DELETING"|"CREATION_FAILED"|"UPDATE_FAILED"|"DELETION_FAILED"
  ),
  tags = list(
    "string"
  )
)

Request syntax

svc$create_scraper(
  alias = "string",
  scrapeConfiguration = list(
    configurationBlob = raw
  ),
  source = list(
    eksConfiguration = list(
      clusterArn = "string",
      securityGroupIds = list(
        "string"
      ),
      subnetIds = list(
        "string"
      )
    ),
    vpcConfiguration = list(
      securityGroupIds = list(
        "string"
      ),
      subnetIds = list(
        "string"
      )
    )
  ),
  destination = list(
    ampConfiguration = list(
      workspaceArn = "string"
    ),
    cloudWatchConfiguration = list(
      datasetArn = "string"
    )
  ),
  roleConfiguration = list(
    sourceRoleArn = "string",
    targetRoleArn = "string"
  ),
  clientToken = "string",
  tags = list(
    "string"
  ),
  exporters = list(
    list(
      openSearchConfiguration = list(
        domainArn = "string"
      )
    )
  )
)