This plugin collects metrics for NVIDIA GPUs including memory and
GPU usage, temperature and other, using the
NVIDIA System Management Interface.
[!IMPORTANT]
This plugin requires the nvidia-smi binary to be installed on the system.
⭐ Telegraf v1.7.0
🏷️ system, hardware
💻 all
Global configuration options
Plugins support additional global and plugin configuration settings for tasks
such as modifying metrics, tags, and fields, creating aliases, and configuring
plugin ordering. See CONFIGURATION.md for more details.
Startup error behavior options
In addition to the plugin-specific and global configuration settings the plugin
supports options for specifying the behavior when experiencing startup errors
using the startup_error_behavior setting. Available values are:
error: Telegraf with stop and exit in case of startup errors. This is the
default behavior.
ignore: Telegraf will ignore startup errors for this plugin and disables it
but continues processing for all other plugins.
retry: NOT AVAILABLE
probe: Telegraf will call the Probe() error method, if available. If the
method returns an error, Telegraf disables the plugin but continues
processing for all other plugins.
Configuration
# Pulls statistics from nvidia GPUs attached to the host
[[inputs.nvidia_smi]]
## Optional: path to nvidia-smi binary, defaults "/usr/bin/nvidia-smi"
## We will first try to locate the nvidia-smi binary with the explicitly specified value (or default value),
## if it is not found, we will try to locate it on PATH(exec.LookPath), if it is still not found, an error will be returned
# bin_path = "/usr/bin/nvidia-smi"
## Optional: timeout for GPU polling
# timeout = "5s"
Linux
On Linux, nvidia-smi is generally located at /usr/bin/nvidia-smi
Windows
On Windows, nvidia-smi is generally located at C:\Program Files\NVIDIA Corporation\NVSMI\nvidia-smi.exe On Windows 10, you may also find this located
here C:\Windows\System32\nvidia-smi.exe
You'll need to escape the \ within the telegraf.conf like this: C:\\Program Files\\NVIDIA Corporation\\NVSMI\\nvidia-smi.exe
Troubleshooting
Check the full output by running nvidia-smi binary manually.
Linux:
sudo -u telegraf -- /usr/bin/nvidia-smi -q -x
Windows:
"C:\Program Files\NVIDIA Corporation\NVSMI\nvidia-smi.exe" -q -x
Please include the output of this command if opening an GitHub issue.
Metrics
- measurement:
nvidia_smi
- tags
name (type of GPU e.g. GeForce GTX 1070 Ti)
arch (Architecture of the GPU e.g. Ampere, schema v12+)
compute_mode (The compute mode of the GPU e.g. Default)
index (Index of the GPU in the nvidia-smi output e.g. 1)
pstate (Performance state of the GPU e.g. P0)
uuid (A unique identifier for the GPU e.g. GPU-f9ba66fc-a7f5-94c5-da19-019ef2f9c665)
- fields
driver_version (string)
cuda_version (string)
serial (string)
vbios_version (string)
display_active (string)
display_mode (string)
current_ecc (string)
fan_speed (integer, percentage)
memory_free (integer, MiB)
memory_used (integer, MiB)
memory_total (integer, MiB)
memory_reserved (integer, MiB)
utilization_gpu (integer, percentage)
utilization_memory (integer, percentage)
utilization_encoder (integer, percentage)
utilization_decoder (integer, percentage)
utilization_jpeg (integer, percentage, schema v12+)
utilization_ofa (integer, percentage, schema v12+)
clocks_current_graphics (integer, MHz)
clocks_current_sm (integer, MHz)
clocks_current_memory (integer, MHz)
clocks_current_video (integer, MHz)
clocks_event_reason_sw_power_cap (integer, 1 when active)
clocks_event_reason_sw_thermal_slowdown (integer, 1 when active)
clocks_event_reason_hw_thermal_slowdown (integer, 1 when active)
clocks_event_reason_hw_power_brake_slowdown (integer, 1 when active)
clocks_event_reason_hw_slowdown (integer, 1 when active)
clocks_event_reason_sync_boost (integer, 1 when active)
clocks_event_reason_gpu_idle (integer, 1 when active)
clocks_event_reason_applications_clocks_setting (integer, 1 when active)
clocks_event_reason_display_clocks_setting (integer, 1 when active)
clocks_event_reasons_counters_sw_power_cap (integer, microseconds,
schema v13)
clocks_event_reasons_counters_sw_therm_slowdown (integer,
microseconds, schema v13)
clocks_event_reasons_counters_hw_therm_slowdown (integer,
microseconds, schema v13)
clocks_event_reasons_counters_hw_power_brake (integer, microseconds,
schema v13)
clocks_event_reasons_counters_sync_boost (integer, microseconds,
schema v13)
temperature_gpu (integer, degrees C)
temperature_memory (integer, degrees C, schema v12+)
temperature_gpu_target (integer, degrees C, schema v12+)
temperature_gpu_target_min (integer, degrees C, schema v12+)
temperature_gpu_target_max (integer, degrees C, schema v12+)
temperature_max_threshold (integer, degrees C, schema v12+)
temperature_slow_threshold (integer, degrees C, schema v12+)
temperature_max_gpu_threshold (integer, degrees C, schema v12+)
temperature_max_mem_threshold (integer, degrees C, schema v12+)
temperature_gpu_tlimit (integer, degrees C, schema v12+)
temperature_max_tlimit_threshold (integer, degrees C, schema v13)
temperature_slow_tlimit_threshold (integer, degrees C, schema v13)
temperature_max_gpu_tlimit_threshold (integer, degrees C, schema v13)
temperature_max_mem_tlimit_threshold (integer, degrees C, schema v13)
power_draw (float, W, instantaneous value when the driver reports
instant_power_draw)
power_draw_average (float, W, schema v12+)
power_limit (float, W, the currently enforced limit)
power_limit_default (float, W, schema v12+)
power_limit_min (float, W, schema v12+)
power_limit_max (float, W, schema v12+)
power_limit_requested (float, W, schema v12+)
module_power_draw (float, W, schema v12+, instantaneous value when the
driver reports instant_power_draw)
pcie_link_gen_current (integer)
pcie_link_width_current (integer)
pcie_rx_util (integer, KB/s, schema v12+)
pcie_tx_util (integer, KB/s, schema v12+)
encoder_stats_session_count (integer)
encoder_stats_average_fps (integer)
encoder_stats_average_latency (integer)
fbc_stats_session_count (integer)
fbc_stats_average_fps (integer)
fbc_stats_average_latency (integer)
retired_pages_multiple_single_bit (integer)
retired_pages_double_bit (integer)
retired_pages_blacklist (string)
retired_pages_pending (string)
remapped_rows_correctable (integer)
remapped_rows_uncorrectable (integer)
remapped_rows_pending (string)
remapped_rows_failure (string)
ecc_errors_volatile_dram_correctable (integer, schema v13)
ecc_errors_volatile_dram_uncorrectable (integer, schema v13)
ecc_errors_volatile_sram_correctable (integer, schema v13)
ecc_errors_volatile_sram_uncorrectable (integer, schema v13)
ecc_errors_volatile_sram_uncorrectable_parity (integer, schema v13)
ecc_errors_volatile_sram_uncorrectable_secded (integer, schema v13)
ecc_errors_aggregate_dram_correctable (integer, schema v13)
ecc_errors_aggregate_dram_uncorrectable (integer, schema v13)
ecc_errors_aggregate_sram_correctable (integer, schema v13)
ecc_errors_aggregate_sram_uncorrectable (integer, schema v13)
ecc_errors_aggregate_sram_uncorrectable_parity (integer, schema v13)
ecc_errors_aggregate_sram_uncorrectable_secded (integer, schema v13)
ecc_errors_aggregate_sram_uncorrectable_l2 (integer, schema v13)
ecc_errors_aggregate_sram_uncorrectable_microcontroller (integer,
schema v13)
ecc_errors_aggregate_sram_uncorrectable_other (integer, schema v13)
ecc_errors_aggregate_sram_uncorrectable_pcie (integer, schema v13)
ecc_errors_aggregate_sram_uncorrectable_sm (integer, schema v13)
ecc_errors_aggregate_sram_threshold_exceeded (string, schema v13)
ecc_errors_channel_repair_pending (string, schema v13)
ecc_errors_tpc_repair_pending (string, schema v13)
ecc_errors_unrepairable_memory (string, schema v13)
- measurement:
nvidia_smi_mig (schema v12+, one per MIG device)
- tags
index (Index of the MIG device e.g. 0)
gpu_index (Index of the GPU instance e.g. 6)
compute_index (Index of the compute instance e.g. 0)
name, arch, pstate, uuid, compute_mode (as above, of the
hosting GPU)
- fields
memory_fb_free (integer, MiB)
memory_fb_used (integer, MiB)
memory_fb_total (integer, MiB)
memory_fb_reserved (integer, MiB)
memory_bar1_free (integer, MiB)
memory_bar1_used (integer, MiB)
memory_bar1_total (integer, MiB)
sram_uncorrectable (integer)
- measurement:
nvidia_smi_process (schema v12+, one point per process and GPU)
- tags
name (Name of the process e.g. python)
type (Context type, C for compute, G for graphics, or C+G)
- fields
pid (integer)
used_memory (integer, MiB)
Not every field is available on every GPU or driver. Fields are only emitted
when nvidia-smi reports a value for them, so cards reporting N/A or
Requested functionality has been deprecated simply omit the field. The
schema v12+ and schema v13 markers above refer to the XML schema version the
installed driver reports, which determines the upper bound of what can be
collected.
Drivers older than 535 report the throttle reasons under their former
clocks_throttle_reason_* element names, but Telegraf emits those under
more modern clocks_event_reason_* field names.
[!TIP]
The clocks_event_reason_* fields report why a GPU is currently clocked
down, as 1 (Active) and 0 (Not Active). On schema v13, five of these
also have clocks_event_reasons_counters_* fields that count the
microseconds spent in that state. The counters catch throttling that
starts and ends between collection intervals. They only ever increase,
so consider using the derivative aggregator to turn
them into rates.
[!NOTE]
The *_tlimit* temperatures are relative to the thermal limit of the GPU, so
temperature_gpu_tlimit counts down to zero as the GPU approaches
throttling. Cards not reporting a thermal limit expose the absolute
temperature_max_threshold variants instead.
Example Output
nvidia_smi,compute_mode=Default,host=8218cf,index=0,name=GeForce\ GTX\ 1070,pstate=P2,uuid=GPU-823bc202-6279-6f2c-d729-868a30f14d96 fan_speed=100i,memory_free=7563i,memory_total=8112i,memory_used=549i,temperature_gpu=53i,utilization_gpu=100i,utilization_memory=90i 1523991122000000000
nvidia_smi,compute_mode=Default,host=8218cf,index=1,name=GeForce\ GTX\ 1080,pstate=P2,uuid=GPU-f9ba66fc-a7f5-94c5-da19-019ef2f9c665 fan_speed=100i,memory_free=7557i,memory_total=8114i,memory_used=557i,temperature_gpu=50i,utilization_gpu=100i,utilization_memory=85i 1523991122000000000
nvidia_smi,compute_mode=Default,host=8218cf,index=2,name=GeForce\ GTX\ 1080,pstate=P2,uuid=GPU-d4cfc28d-0481-8d07-b81a-ddfc63d74adf fan_speed=100i,memory_free=7557i,memory_total=8114i,memory_used=557i,temperature_gpu=58i,utilization_gpu=100i,utilization_memory=86i 1523991122000000000
Limitations
Note that there seems to be an issue with getting current memory clock values
when the memory is overclocked. This may or may not apply to everyone but it's
confirmed to be an issue on an EVGA 2080 Ti.
NOTE: For use with docker either generate your own custom docker image based
on nvidia/cuda which also installs a telegraf package or use volume mount
binding to inject the required
binary into the docker container. In particular you will need to pass through
the /dev/nvidia* devices, the nvidia-smi binary and the nvidia libraries.
An minimal docker-compose example of how to do this is:
telegraf:
image: telegraf
runtime: nvidia
devices:
- /dev/nvidiactl:/dev/nvidiactl
- /dev/nvidia0:/dev/nvidia0
volumes:
- ./telegraf/etc/telegraf.conf:/etc/telegraf/telegraf.conf:ro
- /usr/bin/nvidia-smi:/usr/bin/nvidia-smi:ro
- /usr/lib/x86_64-linux-gnu/nvidia:/usr/lib/x86_64-linux-gnu/nvidia:ro
environment:
- LD_PRELOAD=/usr/lib/x86_64-linux-gnu/nvidia/current/libnvidia-ml.so