diff --git a/service/launchpad/request/req.go b/service/launchpad/request/req.go index 1ff12fe4a55c..31ba559cad65 100644 --- a/service/launchpad/request/req.go +++ b/service/launchpad/request/req.go @@ -38,13 +38,13 @@ func GetQuery(query *api.VMRequest) (string, error) { var result string switch query.Type { case "cpu": - result = "round(sum(node_namespace_pod_container:container_cpu_usage_seconds_total:sum_irate{cluster!=\"\", namespace=~\"$namespace\",pod=~\"$pod.*\"}) by (pod) / sum(cluster:namespace:pod_cpu:active:kube_pod_container_resource_limits{cluster!=\"\", namespace=~\"$namespace\",pod=~\"$pod.*\"}) by (pod)*100,0.01)" + result = "round(sum(node_namespace_pod_container:container_cpu_usage_seconds_total:sum_irate{namespace=~\"$namespace\",pod=~\"$pod.*\"}) by (pod) / sum(cluster:namespace:pod_cpu:active:kube_pod_container_resource_limits{namespace=~\"$namespace\",pod=~\"$pod.*\"}) by (pod)*100,0.01)" case "memory": - result = "round(sum(container_memory_working_set_bytes{job=\"kubelet\", metrics_path=\"/metrics/cadvisor\",cluster!=\"\", namespace=~\"$namespace\",pod=~\"$pod.*\"}) by(pod) / sum(cluster:namespace:pod_memory:active:kube_pod_container_resource_limits{cluster!=\"\", namespace=~\"$namespace\",pod=~\"$pod.*\"}) by (pod) * 100, 0.01)" + result = "round(sum(container_memory_working_set_bytes{job=\"kubelet\", metrics_path=\"/metrics/cadvisor\",namespace=~\"$namespace\",pod=~\"$pod.*\"}) by(pod) / sum(cluster:namespace:pod_memory:active:kube_pod_container_resource_limits{namespace=~\"$namespace\",pod=~\"$pod.*\"}) by (pod) * 100, 0.01)" case "average_cpu": - result = "avg(sum(node_namespace_pod_container:container_cpu_usage_seconds_total:sum_irate{cluster!=\"\", namespace=~\"$namespace\",pod=~\"$pod.*\"}) by (pod) / sum(cluster:namespace:pod_cpu:active:kube_pod_container_resource_limits{cluster!=\"\", namespace=~\"$namespace\",pod=~\"$pod.*\"}) by (pod)*100,0.01)" + result = "avg(sum(node_namespace_pod_container:container_cpu_usage_seconds_total:sum_irate{namespace=~\"$namespace\",pod=~\"$pod.*\"}) by (pod) / sum(cluster:namespace:pod_cpu:active:kube_pod_container_resource_limits{namespace=~\"$namespace\",pod=~\"$pod.*\"}) by (pod)*100,0.01)" case "average_memory": - result = "avg(sum(container_memory_working_set_bytes{job=\"kubelet\", metrics_path=\"/metrics/cadvisor\",cluster!=\"\", namespace=~\"$namespace\",pod=~\"$pod.*\"}) by(pod) / sum(cluster:namespace:pod_memory:active:kube_pod_container_resource_limits{cluster!=\"\", namespace=~\"$namespace\",pod=~\"$pod.*\"}) by (pod) * 100, 0.01)" + result = "avg(sum(container_memory_working_set_bytes{job=\"kubelet\", metrics_path=\"/metrics/cadvisor\",namespace=~\"$namespace\",pod=~\"$pod.*\"}) by(pod) / sum(cluster:namespace:pod_memory:active:kube_pod_container_resource_limits{namespace=~\"$namespace\",pod=~\"$pod.*\"}) by (pod) * 100, 0.01)" default: log.Println(query.Type) }