From db1bc181bd8aa1241caee2a76f79bf57834f11b8 Mon Sep 17 00:00:00 2001 From: Zexi Li Date: Mon, 27 Nov 2023 19:11:06 +0800 Subject: [PATCH] fix(monitor): register agent_nvidia_smi metrics --- pkg/apis/compute/guests.go | 4 +++- pkg/apis/compute/zz_generated.model.go | 10 +++++----- pkg/monitor/dbinit/metric_dbinit.go | 13 +++++++++++++ 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/pkg/apis/compute/guests.go b/pkg/apis/compute/guests.go index 6077a65a1b..0996c93733 100644 --- a/pkg/apis/compute/guests.go +++ b/pkg/apis/compute/guests.go @@ -1046,9 +1046,11 @@ type ServerHardwareInfoGPUPCIEInfo struct { type ServerHardwareInfoGPU struct { *IsolatedDeviceModelHardwareInfo + // isolate device id Id string `json:"id"` // GPU model name - Model string `json:"model"` + Model string `json:"model"` + // PCIE information PCIEInfo *IsolatedDevicePCIEInfo `json:"pcie_info"` } diff --git a/pkg/apis/compute/zz_generated.model.go b/pkg/apis/compute/zz_generated.model.go index fa2f386c62..45ae0d5d28 100644 --- a/pkg/apis/compute/zz_generated.model.go +++ b/pkg/apis/compute/zz_generated.model.go @@ -788,9 +788,9 @@ type SElasticcache struct { NetworkId string `json:"network_id"` // 带宽 Bandwidth int `json:"bandwidth"` - // 内网DNS + // 内网DNS PrivateDNS string `json:"private_dns"` - // 内网IP地址 + // 内网IP地址 PrivateIpAddr string `json:"private_ip_addr"` // 内网访问端口 PrivateConnectPort int `json:"private_connect_port"` @@ -1878,9 +1878,9 @@ type SLoadbalancerHealthCheck struct { // 健康检查路径 / HealthCheckHttpCode string `json:"health_check_http_code"` HealthCheckRise int `json:"health_check_rise"` - // 健康检查健康阈值 3秒 + // 健康检查健康阈值 3秒 HealthCheckFall int `json:"health_check_fall"` - // 健康检查不健康阈值 15秒 + // 健康检查不健康阈值 15秒 HealthCheckTimeout int `json:"health_check_timeout"` // 健康检查超时时间 10秒 HealthCheckInterval int `json:"health_check_interval"` @@ -2511,7 +2511,7 @@ type SSchedtag struct { apis.SStandaloneResourceBase apis.SScopedResourceBase DefaultStrategy string `json:"default_strategy"` - // Column(VARCHAR(16, charset='ascii'), nullable=True, default='') + // Column(VARCHAR(16, charset='ascii'), nullable=True, default=”) ResourceType string `json:"resource_type"` } diff --git a/pkg/monitor/dbinit/metric_dbinit.go b/pkg/monitor/dbinit/metric_dbinit.go index 34f042cb13..57d08dbb08 100644 --- a/pkg/monitor/dbinit/metric_dbinit.go +++ b/pkg/monitor/dbinit/metric_dbinit.go @@ -389,6 +389,19 @@ func init() { newMetricFieldCreateInput("temp_c", "Disk device temperature ", "", 1), }) + // agent nvidia_smi + RegistryMetricCreateInput("agent_nvidia_smi", "Collect Nvidia GPU metrics", + monitor.METRIC_RES_TYPE_AGENT, monitor.METRIC_DATABASE_TELE, 8, []monitor.MetricFieldCreateInput{ + newMetricFieldCreateInput("clocks_current_graphics", "GPU current clocks, MHz", "", 1), + newMetricFieldCreateInput("clocks_current_memory", "GPU current memory clocks, MHz", "", 2), + newMetricFieldCreateInput("temperature_gpu", "GPU temperature", "", 3), + newMetricFieldCreateInput("memory_total", "GPU memory total size", "", 4), + newMetricFieldCreateInput("memory_free", "GPU memory free size", "", 5), + newMetricFieldCreateInput("memory_used", "GPU memory used size", "", 6), + newMetricFieldCreateInput("utilization_gpu", "GPU utilization", "", 7), + newMetricFieldCreateInput("utilization_memory", "GPU memory utilization", "", 8), + }) + RegistryMetricCreateInput("storage", "Storage usage", monitor.METRIC_RES_TYPE_STORAGE, monitor.METRIC_DATABASE_TELE, 1, []monitor.MetricFieldCreateInput{ newMetricFieldCreateInput("usage_active", "Storage utilization rate", monitor.METRIC_UNIT_PERCENT, 1),