createScraper
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. You can configure the scraper to control what metrics are collected, and what transformations are applied prior to sending them to your workspace.
If needed, an IAM role will be created for you that gives Amazon Managed Service for Prometheus access to the metrics in your cluster. For more information, see Using roles for scraping metrics from EKS in the Amazon Managed Service for Prometheus User Guide.
You cannot update a scraper. If you want to change the configuration of the scraper, create a new scraper and delete the old one.
The scrapeConfiguration
parameter contains the base64-encoded version of the YAML configuration file.
For more information about collectors, including what metrics are collected, and how to configure the scraper, see Amazon Web Services managed collectors in the Amazon Managed Service for Prometheus User Guide.
Samples
fun main() {
//sampleStart
// CreateScraper with optional alias input, optional clientToken input, and one set of tags
val resp = ampClient.createScraper {
alias = "alias"
scrapeConfiguration = ScrapeConfiguration.ConfigurationBlob("blob".encodeAsByteArray())
source = Source.EksConfiguration(EksConfiguration {
clusterArn = "arn:aws:eks:us-west-2:123456789012:cluster/example"
securityGroupIds = listOf<String>(
"sg-abc123"
)
subnetIds = listOf<String>(
"subnet-abc123"
)
}
)
destination = Destination.AmpConfiguration(AmpConfiguration {
workspaceArn = "arn:aws:aps:us-west-2:123456789012:workspace/ws-ogh2u499-ce12-hg89-v6c7-123412341234"
}
)
clientToken = "token"
tags = mapOf<String, String>(
"exampleTag" to "exampleValue"
)
}
//sampleEnd
}