fix
This commit is contained in:
parent
11a8963fc5
commit
6c2f3f2bb8
|
@ -45,16 +45,16 @@ const (
|
|||
nvidia_smi_utilization_gpu_ratio = "nvidia_smi_utilization_gpu_ratio{cluster_name='clusterName'}"
|
||||
nvidia_smi_utilization_memory_ratio = "nvidia_smi_utilization_memory_ratio{cluster_name='clusterName'}"
|
||||
|
||||
ClusterName = "clusterName"
|
||||
metric_range_1s = "1s"
|
||||
steps_1s = 100
|
||||
buffer = 5
|
||||
cpu_avg_usage = "avg_over_time(sum by (cluster) (node:node_num_cpu:sum{cluster_name='clusterName',prometheus_replica='prometheus-k8s-0'} * node:node_cpu_utilisation:avg1m{cluster_name='clusterName',prometheus_replica='prometheus-k8s-0'})[7d])"
|
||||
mem_avg_usage = "avg_over_time(sum by (cluster) (node:node_memory_bytes_total:sum{cluster_name='clusterName',prometheus_replica='prometheus-k8s-0'} - node:node_memory_bytes_available:sum{cluster_name='clusterName',prometheus_replica='prometheus-k8s-0'})[7d])"
|
||||
cpu_total_usage = "round(:node_cpu_utilisation:avg1m{cluster_name='clusterName'} * sum(node:node_num_cpu:sum{cluster_name='clusterName'}), 0.001) "
|
||||
mem_total_usage = "sum(node:node_memory_bytes_total:sum{cluster_name='clusterName',prometheus_replica='prometheus-k8s-0'}) - sum(node:node_memory_bytes_available:sum{cluster_name='clusterName',prometheus_replica='prometheus-k8s-0'})"
|
||||
metric_range_7d = "168h"
|
||||
steps_7d = 90000
|
||||
ClusterName = "clusterName"
|
||||
metric_range_1s = "1s"
|
||||
steps_1s = 100
|
||||
buffer = 5
|
||||
cpu_avg_usage = "avg_over_time(sum by (cluster) (node:node_num_cpu:sum{cluster_name='clusterName',prometheus_replica='prometheus-k8s-0'} * node:node_cpu_utilisation:avg1m{cluster_name='clusterName',prometheus_replica='prometheus-k8s-0'})[7d])"
|
||||
mem_avg_usage = "avg_over_time(sum by (cluster) (node:node_memory_bytes_total:sum{cluster_name='clusterName',prometheus_replica='prometheus-k8s-0'} - node:node_memory_bytes_available:sum{cluster_name='clusterName',prometheus_replica='prometheus-k8s-0'})[7d])"
|
||||
cpu_total_usage = "round(:node_cpu_utilisation:avg1m{cluster_name='clusterName',prometheus_replica='prometheus-k8s-0'} * sum(node:node_num_cpu:sum{cluster_name='clusterName',prometheus_replica='prometheus-k8s-0'}), 0.001) "
|
||||
mem_total_usage = "sum(node:node_memory_bytes_total:sum{cluster_name='clusterName',prometheus_replica='prometheus-k8s-0'}) - sum(node:node_memory_bytes_available:sum{cluster_name='clusterName',prometheus_replica='prometheus-k8s-0'})"
|
||||
metric_range_temp = "72h"
|
||||
steps_temp = 7000
|
||||
)
|
||||
|
||||
type Overview struct {
|
||||
|
@ -432,10 +432,10 @@ func GetOverallMetrics(c *gin.Context) {
|
|||
}
|
||||
|
||||
metricMap := map[string][]MetricUrl{
|
||||
"cpu_avg_usage": {{ClusterName, "", GetMetricUrl(strings.TrimRight(imap["cpu_avg_usage"], "+"), nil, "", metric_range_7d, steps_7d)}},
|
||||
"mem_avg_usage": {{ClusterName, "", GetMetricUrl(strings.TrimRight(imap["mem_avg_usage"], "+"), nil, "", metric_range_7d, steps_7d)}},
|
||||
"cpu_total_usage": {{ClusterName, "", GetMetricUrl(strings.TrimRight(imap["cpu_total_usage"], "+"), nil, "", metric_range_7d, steps_7d)}},
|
||||
"mem_total_usage": {{ClusterName, "", GetMetricUrl(strings.TrimRight(imap["mem_total_usage"], "+"), nil, "", metric_range_7d, steps_7d)}},
|
||||
"cpu_avg_usage": {{ClusterName, "", GetMetricUrl(strings.TrimRight(imap["cpu_avg_usage"], "+"), nil, "", metric_range_temp, steps_temp)}},
|
||||
"mem_avg_usage": {{ClusterName, "", GetMetricUrl(strings.TrimRight(imap["mem_avg_usage"], "+"), nil, "", metric_range_temp, steps_temp)}},
|
||||
"cpu_total_usage": {{ClusterName, "", GetMetricUrl(strings.TrimRight(imap["cpu_total_usage"], "+"), nil, "", metric_range_temp, steps_temp)}},
|
||||
"mem_total_usage": {{ClusterName, "", GetMetricUrl(strings.TrimRight(imap["mem_total_usage"], "+"), nil, "", metric_range_temp, steps_temp)}},
|
||||
}
|
||||
|
||||
ch := make(chan MetricResult, len(metricMap))
|
||||
|
|
Loading…
Reference in New Issue