Test a cluster metrics source
import requests
url = "https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/metrics-source/test"
payload = {
"endpoint": "<string>",
"credential_name": "<string>",
"tenant_id": "<string>",
"credential": {
"token": "<string>",
"username": "<string>",
"password": "<string>"
},
"verify_ssl": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
endpoint: '<string>',
credential_name: '<string>',
tenant_id: '<string>',
credential: {token: '<string>', username: '<string>', password: '<string>'},
verify_ssl: false
})
};
fetch('https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/metrics-source/test', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/metrics-source/test \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"endpoint": "<string>",
"credential_name": "<string>",
"tenant_id": "<string>",
"credential": {
"token": "<string>",
"username": "<string>",
"password": "<string>"
},
"verify_ssl": false
}
'{
"ok": true,
"message": "<string>",
"sample_count": 123,
"error_code": "<string>",
"upstream_status_code": 123
}{
"detail": "Cluster not found"
}{
"detail": "permission_denied",
"permission": "<string>",
"scope_type": "<string>"
}{
"detail": "Cluster not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"detail": "Cluster not found"
}Imported Clusters
Test a cluster metrics source
The bearer twin of the portal’s metrics source connection test, for the Ankra app and scripts. Runs a read-only query against the metrics source through the cluster’s agent before you save it; nothing is stored. A probe outcome, success or a classified failure, answers 200 with ok and, on failure, error_code, message and upstream_status_code: a probe result is data, so it never answers a 5xx a proxy could rewrite. Requires clusters.write on the cluster. To save the source, send it in an ImportCluster document’s spec.prometheus_metrics to POST /api/v1/clusters/import.
POST
/
api
/
v1
/
org
/
clusters
/
imported
/
{cluster_id}
/
metrics-source
/
test
Test a cluster metrics source
import requests
url = "https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/metrics-source/test"
payload = {
"endpoint": "<string>",
"credential_name": "<string>",
"tenant_id": "<string>",
"credential": {
"token": "<string>",
"username": "<string>",
"password": "<string>"
},
"verify_ssl": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
endpoint: '<string>',
credential_name: '<string>',
tenant_id: '<string>',
credential: {token: '<string>', username: '<string>', password: '<string>'},
verify_ssl: false
})
};
fetch('https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/metrics-source/test', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://platform.ankra.app/api/v1/org/clusters/imported/{cluster_id}/metrics-source/test \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"endpoint": "<string>",
"credential_name": "<string>",
"tenant_id": "<string>",
"credential": {
"token": "<string>",
"username": "<string>",
"password": "<string>"
},
"verify_ssl": false
}
'{
"ok": true,
"message": "<string>",
"sample_count": 123,
"error_code": "<string>",
"upstream_status_code": 123
}{
"detail": "Cluster not found"
}{
"detail": "permission_denied",
"permission": "<string>",
"scope_type": "<string>"
}{
"detail": "Cluster not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"detail": "Cluster not found"
}Authorizations
Body
application/json
Response
The probe outcome.
The outcome of a read-only connection probe through the cluster's agent.