Skip to content

Commit

Permalink
Extend metrics collected from Nvidia GPUs
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronjwood committed May 26, 2019
1 parent 3c451a1 commit 2325c97
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
9 changes: 9 additions & 0 deletions plugins/inputs/nvidia_smi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 10 additions & 1 deletion plugins/inputs/nvidia_smi/nvidia_smi.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand All @@ -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"},
}
)

Expand Down
8 changes: 4 additions & 4 deletions plugins/inputs/nvidia_smi/nvidia_smi_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
Expand All @@ -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"])
Expand Down

0 comments on commit 2325c97

Please sign in to comment.