2024/10/31 - Amazon Prometheus Service - 1 new 4 updated api methods
Changes Added support for UpdateScraper API, to enable updating collector configuration in-place
Updates an existing scraper.
You can't use this function to update the source from which the scraper is collecting metrics. To change the source, delete the scraper and create a new one.
See also: AWS API Documentation
Request Syntax
client.update_scraper( alias='string', clientToken='string', destination={ 'ampConfiguration': { 'workspaceArn': 'string' } }, scrapeConfiguration={ 'configurationBlob': b'bytes' }, scraperId='string' )
string
The new alias of the scraper.
string
A unique identifier that you can provide to ensure the idempotency of the request. Case-sensitive.
This field is autopopulated if not provided.
dict
The new 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.
dict
Contains the base-64 encoded YAML configuration for the scraper.
Note
For more information about configuring a scraper, see Using an Amazon Web Services managed collector 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.
string
[REQUIRED]
The ID of the scraper to update.
dict
Response Syntax
{ 'arn': 'string', 'scraperId': 'string', 'status': { 'statusCode': 'CREATING'|'UPDATING'|'ACTIVE'|'DELETING'|'CREATION_FAILED'|'UPDATE_FAILED'|'DELETION_FAILED' }, 'tags': { 'string': 'string' } }
Response Structure
(dict) --
arn (string) --
The Amazon Resource Name (ARN) of the updated scraper.
scraperId (string) --
The ID of the updated 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.
{'status': {'statusCode': {'UPDATING', 'UPDATE_FAILED'}}}
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
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' } )
string
(optional) An alias to associate with the scraper. This is for your use, and does not need to be unique.
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.
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.
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.
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.
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.
dict
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.
{'status': {'statusCode': {'UPDATING', 'UPDATE_FAILED'}}}
The DeleteScraper operation deletes one scraper, and stops any metrics collection that the scraper performs.
See also: AWS API Documentation
Request Syntax
client.delete_scraper( clientToken='string', scraperId='string' )
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.
string
[REQUIRED]
The ID of the scraper to delete.
dict
Response Syntax
{ 'scraperId': 'string', 'status': { 'statusCode': 'CREATING'|'UPDATING'|'ACTIVE'|'DELETING'|'CREATION_FAILED'|'UPDATE_FAILED'|'DELETION_FAILED' } }
Response Structure
(dict) --
Represents the output of a DeleteScraper operation.
scraperId (string) --
The ID of the scraper to delete.
status (dict) --
The current status of the scraper.
statusCode (string) --
The current status of the scraper.
{'scraper': {'status': {'statusCode': {'UPDATING', 'UPDATE_FAILED'}}}}
The DescribeScraper operation displays information about an existing scraper.
See also: AWS API Documentation
Request Syntax
client.describe_scraper( scraperId='string' )
string
[REQUIRED]
The ID of the scraper to describe.
dict
Response Syntax
{ 'scraper': { 'alias': 'string', 'arn': 'string', 'createdAt': datetime(2015, 1, 1), 'destination': { 'ampConfiguration': { 'workspaceArn': 'string' } }, 'lastModifiedAt': datetime(2015, 1, 1), 'roleArn': 'string', 'scrapeConfiguration': { 'configurationBlob': b'bytes' }, 'scraperId': 'string', 'source': { 'eksConfiguration': { 'clusterArn': 'string', 'securityGroupIds': [ 'string', ], 'subnetIds': [ 'string', ] } }, 'status': { 'statusCode': 'CREATING'|'UPDATING'|'ACTIVE'|'DELETING'|'CREATION_FAILED'|'UPDATE_FAILED'|'DELETION_FAILED' }, 'statusReason': 'string', 'tags': { 'string': 'string' } } }
Response Structure
(dict) --
Represents the output of a DescribeScraper operation.
scraper (dict) --
Contains details about the scraper.
alias (string) --
(Optional) A name associated with the scraper.
arn (string) --
The Amazon Resource Name (ARN) of the scraper. For example, arn:aws:aps:<region>:123456798012:scraper/s-example1-1234-abcd-5678-ef9012abcd34 .
createdAt (datetime) --
The date and time that the scraper was created.
destination (dict) --
The Amazon Managed Service for Prometheus workspace the scraper sends metrics to.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set: ampConfiguration. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:
'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
ampConfiguration (dict) --
The Amazon Managed Service for Prometheus workspace to send metrics to.
workspaceArn (string) --
ARN of the Amazon Managed Service for Prometheus workspace.
lastModifiedAt (datetime) --
The date and time that the scraper was last modified.
roleArn (string) --
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 .
scrapeConfiguration (dict) --
The configuration in use by the scraper.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set: configurationBlob. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:
'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
configurationBlob (bytes) --
The base 64 encoded scrape configuration file.
scraperId (string) --
The ID of the scraper. For example, s-example1-1234-abcd-5678-ef9012abcd34 .
source (dict) --
The Amazon EKS cluster from which the scraper collects metrics.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set: eksConfiguration. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:
'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
eksConfiguration (dict) --
The Amazon EKS cluster from which a scraper collects metrics.
clusterArn (string) --
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) --
A list of subnet IDs for the Amazon EKS cluster VPC configuration.
(string) --
ID of a VPC subnet.
status (dict) --
A structure that contains the current status of the scraper.
statusCode (string) --
The current status of the scraper.
statusReason (string) --
If there is a failure, the reason for the failure.
tags (dict) --
(Optional) The list of tag keys and values associated with the scraper.
(string) --
The key of the tag. Must not begin with aws: .
(string) --
The value of the tag.
{'scrapers': {'status': {'statusCode': {'UPDATING', 'UPDATE_FAILED'}}}}
The ListScrapers operation lists all of the scrapers in your account. This includes scrapers being created or deleted. You can optionally filter the returned list.
See also: AWS API Documentation
Request Syntax
client.list_scrapers( filters={ 'string': [ 'string', ] }, maxResults=123, nextToken='string' )
dict
(Optional) A list of key-value pairs to filter the list of scrapers returned. Keys include status , sourceArn , destinationArn , and alias .
Filters on the same key are OR 'd together, and filters on different keys are AND 'd together. For example, status=ACTIVE&status=CREATING&alias=Test , will return all scrapers that have the alias Test, and are either in status ACTIVE or CREATING.
To find all active scrapers that are sending metrics to a specific Amazon Managed Service for Prometheus workspace, you would use the ARN of the workspace in a query:
status=ACTIVE&destinationArn=arn:aws:aps:us-east-1:123456789012:workspace/ws-example1-1234-abcd-56ef-123456789012
If this is included, it filters the results to only the scrapers that match the filter.
(string) --
The name of the key to filter by. Currently supported filter keys are status , sourceArn , destinationArn , and alias .
(list) --
The values of the given key by which to filter.
(string) --
The value for a given key by which to filter.
integer
Optional) The maximum number of scrapers to return in one ListScrapers operation. The range is 1-1000.
If you omit this parameter, the default of 100 is used.
string
(Optional) The token for the next set of items to return. (You received this token from a previous call.)
dict
Response Syntax
{ 'nextToken': 'string', 'scrapers': [ { 'alias': 'string', 'arn': 'string', 'createdAt': datetime(2015, 1, 1), 'destination': { 'ampConfiguration': { 'workspaceArn': 'string' } }, 'lastModifiedAt': datetime(2015, 1, 1), 'roleArn': 'string', 'scraperId': 'string', 'source': { 'eksConfiguration': { 'clusterArn': 'string', 'securityGroupIds': [ 'string', ], 'subnetIds': [ 'string', ] } }, 'status': { 'statusCode': 'CREATING'|'UPDATING'|'ACTIVE'|'DELETING'|'CREATION_FAILED'|'UPDATE_FAILED'|'DELETION_FAILED' }, 'statusReason': 'string', 'tags': { 'string': 'string' } }, ] }
Response Structure
(dict) --
Represents the output of a ListScrapers operation.
nextToken (string) --
A token indicating that there are more results to retrieve. You can use this token as part of your next ListScrapers operation to retrieve those results.
scrapers (list) --
A list of ScraperSummary structures giving information about scrapers in the account that match the filters provided.
(dict) --
The ScraperSummary structure contains a summary of the details about one scraper in your account.
alias (string) --
(Optional) A name associated with the scraper.
arn (string) --
The Amazon Resource Name (ARN) of the scraper.
createdAt (datetime) --
The date and time that the scraper was created.
destination (dict) --
The Amazon Managed Service for Prometheus workspace the scraper sends metrics to.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set: ampConfiguration. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:
'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
ampConfiguration (dict) --
The Amazon Managed Service for Prometheus workspace to send metrics to.
workspaceArn (string) --
ARN of the Amazon Managed Service for Prometheus workspace.
lastModifiedAt (datetime) --
The date and time that the scraper was last modified.
roleArn (string) --
The Amazon Resource Name (ARN) of the IAM role that provides permissions for the scraper to discover and collect metrics on your behalf.
scraperId (string) --
The ID of the scraper.
source (dict) --
The Amazon EKS cluster from which the scraper collects metrics.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set: eksConfiguration. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:
'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
eksConfiguration (dict) --
The Amazon EKS cluster from which a scraper collects metrics.
clusterArn (string) --
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) --
A list of subnet IDs for the Amazon EKS cluster VPC configuration.
(string) --
ID of a VPC subnet.
status (dict) --
A structure that contains the current status of the scraper.
statusCode (string) --
The current status of the scraper.
statusReason (string) --
If there is a failure, the reason for the failure.
tags (dict) --
(Optional) The list of tag keys and values associated with the scraper.
(string) --
The key of the tag. Must not begin with aws: .
(string) --
The value of the tag.