|
|
@@ -140,17 +140,17 @@ func ComputeClusterCosts(client prometheus.Client, provider cloud.Provider, wind
|
|
|
) by (cluster_id)`
|
|
|
|
|
|
const fmtQueryTotalCPU = `sum(
|
|
|
- sum(sum_over_time(avg(kube_node_status_capacity_cpu_cores) by (node, cluster_id)[%s:1m]%s)) by (node, cluster_id) *
|
|
|
+ sum_over_time(avg(kube_node_status_capacity_cpu_cores) by (node, cluster_id)[%s:1m]%s) *
|
|
|
avg(avg_over_time(node_cpu_hourly_cost[%s:1m]%s)) by (node, cluster_id) / 60
|
|
|
) by (cluster_id)`
|
|
|
|
|
|
const fmtQueryTotalRAM = `sum(
|
|
|
- sum(sum_over_time(avg(kube_node_status_capacity_memory_bytes) by (node, cluster_id)[%s:1m]%s) / 1024 / 1024 / 1024) by (node, cluster_id) *
|
|
|
+ sum_over_time(avg(kube_node_status_capacity_memory_bytes) by (node, cluster_id)[%s:1m]%s) / 1024 / 1024 / 1024 *
|
|
|
avg(avg_over_time(node_ram_hourly_cost[%s:1m]%s)) by (node, cluster_id) / 60
|
|
|
) by (cluster_id)`
|
|
|
|
|
|
const fmtQueryTotalStorage = `sum(
|
|
|
- sum(sum_over_time(avg(kube_persistentvolume_capacity_bytes) by (persistentvolume, cluster_id)[%s:1m]%s)) by (persistentvolume, cluster_id) / 1024 / 1024 / 1024 *
|
|
|
+ sum_over_time(avg(kube_persistentvolume_capacity_bytes) by (persistentvolume, cluster_id)[%s:1m]%s) / 1024 / 1024 / 1024 *
|
|
|
avg(avg_over_time(pv_hourly_cost[%s:1m]%s)) by (persistentvolume, cluster_id) / 60
|
|
|
) by (cluster_id) %s`
|
|
|
|