Kubernetes clusters
Get kubernetes cluster prometheus metrics
Returns CPU, memory, pressure, network, disk, and load time-series summed (additive) or averaged (ratios) across every node in the cluster
GET
/
api
/
v1
/
tenant
/
clusters
/
{cluster_id}
/
prometheus-metrics
Get kubernetes cluster prometheus metrics
curl --request GET \
--url https://api.costgraph.ai/api/v1/tenant/clusters/{cluster_id}/prometheus-metrics \
--header 'Authorization: <api-key>' \
--header 'X-CostGraph-Tenant-ID: <x-costgraph-tenant-id>'import requests
url = "https://api.costgraph.ai/api/v1/tenant/clusters/{cluster_id}/prometheus-metrics"
headers = {
"X-CostGraph-Tenant-ID": "<x-costgraph-tenant-id>",
"Authorization": "<api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'X-CostGraph-Tenant-ID': '<x-costgraph-tenant-id>', Authorization: '<api-key>'}
};
fetch('https://api.costgraph.ai/api/v1/tenant/clusters/{cluster_id}/prometheus-metrics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.costgraph.ai/api/v1/tenant/clusters/{cluster_id}/prometheus-metrics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"X-CostGraph-Tenant-ID: <x-costgraph-tenant-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.costgraph.ai/api/v1/tenant/clusters/{cluster_id}/prometheus-metrics"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-CostGraph-Tenant-ID", "<x-costgraph-tenant-id>")
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.costgraph.ai/api/v1/tenant/clusters/{cluster_id}/prometheus-metrics")
.header("X-CostGraph-Tenant-ID", "<x-costgraph-tenant-id>")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.costgraph.ai/api/v1/tenant/clusters/{cluster_id}/prometheus-metrics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-CostGraph-Tenant-ID"] = '<x-costgraph-tenant-id>'
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"message": "some message",
"status": "success",
"data": {
"end": "<string>",
"start": "<string>",
"step_seconds": 123,
"cpu_irq": [
{
"t": 123,
"v": 123
}
],
"cpu_nice": [
{
"t": 123,
"v": 123
}
],
"cpu_psi_some": [
{
"t": 123,
"v": 123
}
],
"cpu_softirq": [
{
"t": 123,
"v": 123
}
],
"cpu_steal": [
{
"t": 123,
"v": 123
}
],
"cpu_system": [
{
"t": 123,
"v": 123
}
],
"cpu_user": [
{
"t": 123,
"v": 123
}
],
"cpu_utilization": [
{
"t": 123,
"v": 123
}
],
"cpu_wait": [
{
"t": 123,
"v": 123
}
],
"disk_busy_percent": [
{
"t": 123,
"v": 123
}
],
"disk_read_iops": [
{
"t": 123,
"v": 123
}
],
"disk_read_latency": [
{
"t": 123,
"v": 123
}
],
"disk_read_throughput": [
{
"t": 123,
"v": 123
}
],
"disk_utilization": [
{
"t": 123,
"v": 123
}
],
"disk_write_iops": [
{
"t": 123,
"v": 123
}
],
"disk_write_latency": [
{
"t": 123,
"v": 123
}
],
"disk_write_throughput": [
{
"t": 123,
"v": 123
}
],
"gpu_availability": {},
"gpu_identity_source": "<string>",
"gpu_memory_used_mib": [
{
"t": 123,
"v": 123
}
],
"gpu_memory_utilization": [
{
"t": 123,
"v": 123
}
],
"gpu_power_utilization": [
{
"t": 123,
"v": 123
}
],
"gpu_power_watts": [
{
"t": 123,
"v": 123
}
],
"gpu_series": {},
"gpu_units": {},
"gpu_utilization": [
{
"t": 123,
"v": 123
}
],
"io_psi_some": [
{
"t": 123,
"v": 123
}
],
"load_average_15m": [
{
"t": 123,
"v": 123
}
],
"load_average_1m": [
{
"t": 123,
"v": 123
}
],
"load_average_5m": [
{
"t": 123,
"v": 123
}
],
"memory_available": [
{
"t": 123,
"v": 123
}
],
"memory_buffers": [
{
"t": 123,
"v": 123
}
],
"memory_buffers_percent": [
{
"t": 123,
"v": 123
}
],
"memory_cached": [
{
"t": 123,
"v": 123
}
],
"memory_cached_percent": [
{
"t": 123,
"v": 123
}
],
"memory_free": [
{
"t": 123,
"v": 123
}
],
"memory_psi_some": [
{
"t": 123,
"v": 123
}
],
"memory_used": [
{
"t": 123,
"v": 123
}
],
"memory_utilization": [
{
"t": 123,
"v": 123
}
],
"network_receive": [
{
"t": 123,
"v": 123
}
],
"network_transmit": [
{
"t": 123,
"v": 123
}
],
"swap_utilization": [
{
"t": 123,
"v": 123
}
],
"tcp_retransmits": [
{
"t": 123,
"v": 123
}
]
}
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}Authorizations
Enter "Bearer {token}"
Headers
Tenant ID
Path Parameters
Kubernetes cluster ID
Query Parameters
Time window (e.g. 1h, 24h, 7d). Default 1h
Resolution step
Metric groups (comma-separated): all,system,cpu,memory,disk,network,load. Default all
Was this page helpful?
⌘I
Get kubernetes cluster prometheus metrics
curl --request GET \
--url https://api.costgraph.ai/api/v1/tenant/clusters/{cluster_id}/prometheus-metrics \
--header 'Authorization: <api-key>' \
--header 'X-CostGraph-Tenant-ID: <x-costgraph-tenant-id>'import requests
url = "https://api.costgraph.ai/api/v1/tenant/clusters/{cluster_id}/prometheus-metrics"
headers = {
"X-CostGraph-Tenant-ID": "<x-costgraph-tenant-id>",
"Authorization": "<api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'X-CostGraph-Tenant-ID': '<x-costgraph-tenant-id>', Authorization: '<api-key>'}
};
fetch('https://api.costgraph.ai/api/v1/tenant/clusters/{cluster_id}/prometheus-metrics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.costgraph.ai/api/v1/tenant/clusters/{cluster_id}/prometheus-metrics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"X-CostGraph-Tenant-ID: <x-costgraph-tenant-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.costgraph.ai/api/v1/tenant/clusters/{cluster_id}/prometheus-metrics"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-CostGraph-Tenant-ID", "<x-costgraph-tenant-id>")
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.costgraph.ai/api/v1/tenant/clusters/{cluster_id}/prometheus-metrics")
.header("X-CostGraph-Tenant-ID", "<x-costgraph-tenant-id>")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.costgraph.ai/api/v1/tenant/clusters/{cluster_id}/prometheus-metrics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-CostGraph-Tenant-ID"] = '<x-costgraph-tenant-id>'
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"message": "some message",
"status": "success",
"data": {
"end": "<string>",
"start": "<string>",
"step_seconds": 123,
"cpu_irq": [
{
"t": 123,
"v": 123
}
],
"cpu_nice": [
{
"t": 123,
"v": 123
}
],
"cpu_psi_some": [
{
"t": 123,
"v": 123
}
],
"cpu_softirq": [
{
"t": 123,
"v": 123
}
],
"cpu_steal": [
{
"t": 123,
"v": 123
}
],
"cpu_system": [
{
"t": 123,
"v": 123
}
],
"cpu_user": [
{
"t": 123,
"v": 123
}
],
"cpu_utilization": [
{
"t": 123,
"v": 123
}
],
"cpu_wait": [
{
"t": 123,
"v": 123
}
],
"disk_busy_percent": [
{
"t": 123,
"v": 123
}
],
"disk_read_iops": [
{
"t": 123,
"v": 123
}
],
"disk_read_latency": [
{
"t": 123,
"v": 123
}
],
"disk_read_throughput": [
{
"t": 123,
"v": 123
}
],
"disk_utilization": [
{
"t": 123,
"v": 123
}
],
"disk_write_iops": [
{
"t": 123,
"v": 123
}
],
"disk_write_latency": [
{
"t": 123,
"v": 123
}
],
"disk_write_throughput": [
{
"t": 123,
"v": 123
}
],
"gpu_availability": {},
"gpu_identity_source": "<string>",
"gpu_memory_used_mib": [
{
"t": 123,
"v": 123
}
],
"gpu_memory_utilization": [
{
"t": 123,
"v": 123
}
],
"gpu_power_utilization": [
{
"t": 123,
"v": 123
}
],
"gpu_power_watts": [
{
"t": 123,
"v": 123
}
],
"gpu_series": {},
"gpu_units": {},
"gpu_utilization": [
{
"t": 123,
"v": 123
}
],
"io_psi_some": [
{
"t": 123,
"v": 123
}
],
"load_average_15m": [
{
"t": 123,
"v": 123
}
],
"load_average_1m": [
{
"t": 123,
"v": 123
}
],
"load_average_5m": [
{
"t": 123,
"v": 123
}
],
"memory_available": [
{
"t": 123,
"v": 123
}
],
"memory_buffers": [
{
"t": 123,
"v": 123
}
],
"memory_buffers_percent": [
{
"t": 123,
"v": 123
}
],
"memory_cached": [
{
"t": 123,
"v": 123
}
],
"memory_cached_percent": [
{
"t": 123,
"v": 123
}
],
"memory_free": [
{
"t": 123,
"v": 123
}
],
"memory_psi_some": [
{
"t": 123,
"v": 123
}
],
"memory_used": [
{
"t": 123,
"v": 123
}
],
"memory_utilization": [
{
"t": 123,
"v": 123
}
],
"network_receive": [
{
"t": 123,
"v": 123
}
],
"network_transmit": [
{
"t": 123,
"v": 123
}
],
"swap_utilization": [
{
"t": 123,
"v": 123
}
],
"tcp_retransmits": [
{
"t": 123,
"v": 123
}
]
}
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}