CreatePrometheusScrapeJob
In this article:
CreatePrometheusScrapeJob#
Description#
Request to create a data scrape job for a PaaS service.
Request Parameters#
name — The scrape job name.
Type: String
Required: Yes
parameters — The scrape job parameters.
Type: Dict
Required: Yes
serviceId — The PaaS service ID.
Type: String
Required: Yes
Response Elements#
prometheusScrapeJob — Information about the scrape job.
Type: PrometheusScrapeJob object
Examples#
Managing PaaS services in K2 Cloud via API requires a customized version of the boto3 library:
import boto3
session = boto3.Session(
aws_access_key_id="<AWS_ACCESS_KEY_ID>",
aws_secret_access_key="<AWS_SECRET_ACCESS_KEY>",
region_name="",
)
paas_client = session.client(
"paas",
endpoint_url='https://paas.k2.cloud/',
)
route = paas_client.create_prometheus_scrape_job(
serviceId='fm-cluster-1ACD3963',
name="job1",
parameters={
"targets": ["192.168.1.150:443"],
"labels": {
"node": "gitlab",
"environment": "prod",
}
}
)
Or c2-paas utility from K2 Cloud API Client software suite:
c2-paas CreatePrometheusScrapeJob serviceId fm-cluster-1ACD3963 name job1 parameters.targets.0 "192.168.1.150:443" parameters.labels.node gitlab parameters.labels.environment prod