Class CfnScraper

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IInspectable, ITaggableV2, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-12-06T14:43:14.437Z") @Stability(Stable) public class CfnScraper extends CfnResource implements IInspectable, ITaggableV2
A scraper is a fully-managed agentless collector that discovers and pulls metrics automatically.

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. You can configure the scraper 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 YAML configuration for the scraper.

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

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.services.aps.*;
 CfnScraper cfnScraper = CfnScraper.Builder.create(this, "MyCfnScraper")
         .destination(DestinationProperty.builder()
                 .ampConfiguration(AmpConfigurationProperty.builder()
                         .workspaceArn("workspaceArn")
                         .build())
                 .build())
         .scrapeConfiguration(ScrapeConfigurationProperty.builder()
                 .configurationBlob("configurationBlob")
                 .build())
         .source(SourceProperty.builder()
                 .eksConfiguration(EksConfigurationProperty.builder()
                         .clusterArn("clusterArn")
                         .subnetIds(List.of("subnetIds"))
                         // the properties below are optional
                         .securityGroupIds(List.of("securityGroupIds"))
                         .build())
                 .build())
         // the properties below are optional
         .alias("alias")
         .tags(List.of(CfnTag.builder()
                 .key("key")
                 .value("value")
                 .build()))
         .build();
 

See Also:
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String CFN_RESOURCE_TYPE_NAME
      The CloudFormation resource type name for this resource class.
  • Constructor Details

    • CfnScraper

      protected CfnScraper(software.amazon.jsii.JsiiObjectRef objRef)
    • CfnScraper

      protected CfnScraper(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CfnScraper

      @Stability(Stable) public CfnScraper(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnScraperProps props)
      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). This parameter is required.
      props - Resource properties. This parameter is required.
  • Method Details

    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      Parameters:
      inspector - tree inspector to collect and process attributes. This parameter is required.
    • renderProperties

      @Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
      Overrides:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrArn

      @Stability(Stable) @NotNull public String getAttrArn()
      The Amazon Resource Name (ARN) of the scraper.

      For example, arn:aws:aps:<region>:123456798012:scraper/s-example1-1234-abcd-5678-ef9012abcd34 .

    • getAttrRoleArn

      @Stability(Stable) @NotNull public String getAttrRoleArn()
      The Amazon Resource Name (ARN) of the IAM role that provides permissions for the scraper to discover and collect metrics on your behalf.

      For example, arn:aws:iam::123456789012:role/service-role/AmazonGrafanaServiceRole-12example .

    • getAttrScraperId

      @Stability(Stable) @NotNull public String getAttrScraperId()
      The ID of the scraper.

      For example, s-example1-1234-abcd-5678-ef9012abcd34 .

    • getCdkTagManager

      @Stability(Stable) @NotNull public TagManager getCdkTagManager()
      Tag Manager which manages the tags for this resource.
      Specified by:
      getCdkTagManager in interface ITaggableV2
    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getDestination

      @Stability(Stable) @NotNull public Object getDestination()
      The Amazon Managed Service for Prometheus workspace the scraper sends metrics to.
    • setDestination

      @Stability(Stable) public void setDestination(@NotNull IResolvable value)
      The Amazon Managed Service for Prometheus workspace the scraper sends metrics to.
    • setDestination

      @Stability(Stable) public void setDestination(@NotNull CfnScraper.DestinationProperty value)
      The Amazon Managed Service for Prometheus workspace the scraper sends metrics to.
    • getScrapeConfiguration

      @Stability(Stable) @NotNull public Object getScrapeConfiguration()
      The configuration in use by the scraper.
    • setScrapeConfiguration

      @Stability(Stable) public void setScrapeConfiguration(@NotNull IResolvable value)
      The configuration in use by the scraper.
    • setScrapeConfiguration

      @Stability(Stable) public void setScrapeConfiguration(@NotNull CfnScraper.ScrapeConfigurationProperty value)
      The configuration in use by the scraper.
    • getSource

      @Stability(Stable) @NotNull public Object getSource()
      The Amazon EKS cluster from which the scraper collects metrics.
    • setSource

      @Stability(Stable) public void setSource(@NotNull IResolvable value)
      The Amazon EKS cluster from which the scraper collects metrics.
    • setSource

      @Stability(Stable) public void setSource(@NotNull CfnScraper.SourceProperty value)
      The Amazon EKS cluster from which the scraper collects metrics.
    • getAlias

      @Stability(Stable) @Nullable public String getAlias()
      An optional user-assigned scraper alias.
    • setAlias

      @Stability(Stable) public void setAlias(@Nullable String value)
      An optional user-assigned scraper alias.
    • getTags

      @Stability(Stable) @Nullable public List<CfnTag> getTags()
      (Optional) The list of tag keys and values associated with the scraper.
    • setTags

      @Stability(Stable) public void setTags(@Nullable List<CfnTag> value)
      (Optional) The list of tag keys and values associated with the scraper.