PrometheusService / Client / create_scraper

create_scraper#

PrometheusService.Client.create_scraper(**kwargs)#

The CreateScraper operation creates a scraper to collect metrics. A scraper pulls metrics from Prometheus-compatible sources within an Amazon EKS cluster, and sends them to your Amazon Managed Service for Prometheus workspace. Scrapers are flexible, and can be configured to control what metrics are collected, the frequency of collection, what transformations are applied 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 cluster. You must configure this role with a policy that allows it to scrape metrics from your cluster. For more information, 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.

Note

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.

See also: AWS API Documentation

Request Syntax

response = client.create_scraper(
    alias='string',
    clientToken='string',
    destination={
        'ampConfiguration': {
            'workspaceArn': 'string'
        }
    },
    scrapeConfiguration={
        'configurationBlob': b'bytes'
    },
    source={
        'eksConfiguration': {
            'clusterArn': 'string',
            'securityGroupIds': [
                'string',
            ],
            'subnetIds': [
                'string',
            ]
        }
    },
    tags={
        'string': 'string'
    }
)
Parameters:
  • alias (string) – (optional) An alias to associate with the scraper. This is for your use, and does not need to be unique.

  • clientToken (string) –

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

    This field is autopopulated if not provided.

  • destination (dict) –

    [REQUIRED]

    The Amazon Managed Service for Prometheus workspace to send metrics to.

    Note

    This is a Tagged Union structure. Only one of the following top level keys can be set: ampConfiguration.

    • ampConfiguration (dict) –

      The Amazon Managed Service for Prometheus workspace to send metrics to.

      • workspaceArn (string) – [REQUIRED]

        ARN of the Amazon Managed Service for Prometheus workspace.

  • scrapeConfiguration (dict) –

    [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.

    Note

    This is a Tagged Union structure. Only one of the following top level keys can be set: configurationBlob.

    • configurationBlob (bytes) –

      The base 64 encoded scrape configuration file.

  • source (dict) –

    [REQUIRED]

    The Amazon EKS cluster from which the scraper will collect metrics.

    Note

    This is a Tagged Union structure. Only one of the following top level keys can be set: eksConfiguration.

    • eksConfiguration (dict) –

      The Amazon EKS cluster from which a scraper collects metrics.

      • clusterArn (string) – [REQUIRED]

        ARN of the Amazon EKS cluster.

      • securityGroupIds (list) –

        A list of the security group IDs for the Amazon EKS cluster VPC configuration.

        • (string) –

          ID of a VPC security group.

      • subnetIds (list) – [REQUIRED]

        A list of subnet IDs for the Amazon EKS cluster VPC configuration.

        • (string) –

          ID of a VPC subnet.

  • tags (dict) –

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

    • (string) –

      The key of the tag. Must not begin with aws:.

      • (string) –

        The value of the tag.

Return type:

dict

Returns:

Response Syntax

{
    'arn': 'string',
    'scraperId': 'string',
    'status': {
        'statusCode': 'CREATING'|'UPDATING'|'ACTIVE'|'DELETING'|'CREATION_FAILED'|'UPDATE_FAILED'|'DELETION_FAILED'
    },
    'tags': {
        'string': 'string'
    }
}

Response Structure

  • (dict) –

    Represents the output of a CreateScraper operation.

    • arn (string) –

      The Amazon Resource Name (ARN) of the new scraper.

    • scraperId (string) –

      The ID of the new scraper.

    • status (dict) –

      A structure that displays the current status of the scraper.

      • statusCode (string) –

        The current status of the scraper.

    • tags (dict) –

      The list of tag keys and values that are associated with the scraper.

      • (string) –

        The key of the tag. Must not begin with aws:.

        • (string) –

          The value of the tag.

Exceptions