From 77659f33bc0cfc1ca1b161b2e2a118c3a4fa671d Mon Sep 17 00:00:00 2001 From: Aaron Wood Date: Sun, 26 May 2019 19:02:09 -0700 Subject: [PATCH] Extend metrics collected from Nvidia GPUs (#5885) --- plugins/inputs/nvidia_smi/README.md | 9 +++++++++ plugins/inputs/nvidia_smi/nvidia_smi.go | 11 ++++++++++- plugins/inputs/nvidia_smi/nvidia_smi_test.go | 8 ++++---- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/plugins/inputs/nvidia_smi/README.md b/plugins/inputs/nvidia_smi/README.md index b59f2ee6a..c3bac8da5 100644 --- a/plugins/inputs/nvidia_smi/README.md +++ b/plugins/inputs/nvidia_smi/README.md @@ -35,6 +35,15 @@ On Windows, `nvidia-smi` is generally located at `C:\Program Files\NVIDIA Corpor - `temperature_gpu` (integer, degrees C) - `utilization_gpu` (integer, percentage) - `utilization_memory` (integer, percentage) + - `pcie_link_gen_current` (integer) + - `pcie_link_width_current` (integer) + - `encoder_stats_session_count` (integer) + - `encoder_stats_average_fps` (integer) + - `encoder_stats_average_latency` (integer) + - `clocks_current_graphics` (integer, MHz) + - `clocks_current_sm` (integer, MHz) + - `clocks_current_memory` (integer, MHz) + - `clocks_current_video` (integer, MHz) ### Sample Query diff --git a/plugins/inputs/nvidia_smi/nvidia_smi.go b/plugins/inputs/nvidia_smi/nvidia_smi.go index ea708f24f..37dde689a 100644 --- a/plugins/inputs/nvidia_smi/nvidia_smi.go +++ b/plugins/inputs/nvidia_smi/nvidia_smi.go @@ -16,7 +16,7 @@ import ( var ( measurement = "nvidia_smi" - metrics = "fan.speed,memory.total,memory.used,memory.free,pstate,temperature.gpu,name,uuid,compute_mode,utilization.gpu,utilization.memory,index,power.draw" + metrics = "fan.speed,memory.total,memory.used,memory.free,pstate,temperature.gpu,name,uuid,compute_mode,utilization.gpu,utilization.memory,index,power.draw,pcie.link.gen.current,pcie.link.width.current,encoder.stats.sessionCount,encoder.stats.averageFps,encoder.stats.averageLatency,clocks.current.graphics,clocks.current.sm,clocks.current.memory,clocks.current.video" metricNames = [][]string{ {"fan_speed", "integer"}, {"memory_total", "integer"}, @@ -31,6 +31,15 @@ var ( {"utilization_memory", "integer"}, {"index", "tag"}, {"power_draw", "float"}, + {"pcie_link_gen_current", "integer"}, + {"pcie_link_width_current", "integer"}, + {"encoder_stats_session_count", "integer"}, + {"encoder_stats_average_fps", "integer"}, + {"encoder_stats_average_latency", "integer"}, + {"clocks_current_graphics", "integer"}, + {"clocks_current_sm", "integer"}, + {"clocks_current_memory", "integer"}, + {"clocks_current_video", "integer"}, } ) diff --git a/plugins/inputs/nvidia_smi/nvidia_smi_test.go b/plugins/inputs/nvidia_smi/nvidia_smi_test.go index 87785fe87..4e0cc8eac 100644 --- a/plugins/inputs/nvidia_smi/nvidia_smi_test.go +++ b/plugins/inputs/nvidia_smi/nvidia_smi_test.go @@ -7,15 +7,15 @@ import ( ) func TestParseLineStandard(t *testing.T) { - line := "85, 8114, 553, 7561, P2, 61, GeForce GTX 1070 Ti, GPU-d1911b8a-f5c8-5e66-057c-486561269de8, Default, 100, 93, 1, 0.0\n" + line := "41, 11264, 1074, 10190, P8, 32, GeForce RTX 2080 Ti, GPU-c97b7f88-c06d-650f-5339-f8dd0c1315c0, Default, 1, 4, 0, 24.33, 1, 16, 0, 0, 0, 300, 300, 405, 540\n" tags, fields, err := parseLine(line) if err != nil { t.Fail() } - if tags["name"] != "GeForce GTX 1070 Ti" { + if tags["name"] != "GeForce RTX 2080 Ti" { t.Fail() } - if temp, ok := fields["temperature_gpu"].(int); ok && temp == 61 { + if temp, ok := fields["temperature_gpu"].(int); ok && temp != 32 { t.Fail() } } @@ -37,7 +37,7 @@ func TestParseLineBad(t *testing.T) { } func TestParseLineNotSupported(t *testing.T) { - line := "[Not Supported], 7606, 0, 7606, P0, 38, Tesla P4, GPU-xxx, Default, 0, 0, 0, 0.0\n" + line := "[Not Supported], 11264, 1074, 10190, P8, 32, GeForce RTX 2080 Ti, GPU-c97b7f88-c06d-650f-5339-f8dd0c1315c0, Default, 1, 4, 0, 24.33, 1, 16, 0, 0, 0, 300, 300, 405, 540\n" _, fields, err := parseLine(line) require.NoError(t, err) require.Equal(t, nil, fields["fan_speed"])