diff --git a/cpp/CHANGELOG.md b/cpp/CHANGELOG.md index b8b854c258..5512f809c2 100644 --- a/cpp/CHANGELOG.md +++ b/cpp/CHANGELOG.md @@ -17,6 +17,7 @@ Please mark all change in change log and use the ticket from JIRA. - MS-640 - Cache object size calculate incorrect - MS-641 - Segment fault(signal 11) in PickToLoad - MS-639 - SQ8H index created failed and server hang +- MS-647 - [monitor] grafana display average cpu-temp ## Improvement - MS-552 - Add and change the easylogging library diff --git a/cpp/src/metrics/PrometheusMetrics.cpp b/cpp/src/metrics/PrometheusMetrics.cpp index 182f14d46c..dec7c264fd 100644 --- a/cpp/src/metrics/PrometheusMetrics.cpp +++ b/cpp/src/metrics/PrometheusMetrics.cpp @@ -222,10 +222,19 @@ PrometheusMetrics::CPUTemperature() { std::vector CPU_temperatures = server::SystemInfo::GetInstance().CPUTemperature(); + float avg_cpu_temp = 0; for (int i = 0; i < CPU_temperatures.size(); ++i) { - prometheus::Gauge& cpu_temp = CPU_temperature_.Add({{"CPU", std::to_string(i)}}); - cpu_temp.Set(CPU_temperatures[i]); + avg_cpu_temp += CPU_temperatures[i]; } + avg_cpu_temp /= CPU_temperatures.size(); + + prometheus::Gauge& cpu_temp = CPU_temperature_.Add({{"CPU", std::to_string(0)}}); + cpu_temp.Set(avg_cpu_temp); + +// for (int i = 0; i < CPU_temperatures.size(); ++i) { +// prometheus::Gauge& cpu_temp = CPU_temperature_.Add({{"CPU", std::to_string(i)}}); +// cpu_temp.Set(CPU_temperatures[i]); +// } } void