From 34a0b66bc2d48223748ed1cf5bc1b305c396bd74 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 26 Jan 2022 19:05:10 +0100 Subject: Adding upstream version 1.33.0. Signed-off-by: Daniel Baumann --- .../python.d.plugin/nvidia_smi/nvidia_smi.chart.py | 33 ++++++++++++++++++---- 1 file changed, 27 insertions(+), 6 deletions(-) (limited to 'collectors/python.d.plugin/nvidia_smi') diff --git a/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py b/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py index 9c69586dd..00bc7884d 100644 --- a/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py +++ b/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py @@ -28,6 +28,7 @@ GPU_UTIL = 'gpu_utilization' MEM_UTIL = 'mem_utilization' ENCODER_UTIL = 'encoder_utilization' MEM_USAGE = 'mem_usage' +BAR_USAGE = 'bar1_mem_usage' TEMPERATURE = 'temperature' CLOCKS = 'clocks' POWER = 'power' @@ -42,6 +43,7 @@ ORDER = [ MEM_UTIL, ENCODER_UTIL, MEM_USAGE, + BAR_USAGE, TEMPERATURE, CLOCKS, POWER, @@ -95,6 +97,13 @@ def gpu_charts(gpu): ['fb_memory_used', 'used'], ] }, + BAR_USAGE: { + 'options': [None, 'Bar1 Memory Usage', 'MiB', fam, 'nvidia_smi.bar1_memory_usage', 'stacked'], + 'lines': [ + ['bar1_memory_free', 'free'], + ['bar1_memory_used', 'used'], + ] + }, TEMPERATURE: { 'options': [None, 'Temperature', 'celsius', fam, 'nvidia_smi.temperature', 'line'], 'lines': [ @@ -285,12 +294,14 @@ def get_username_by_pid_safe(pid, passwd_file): try: uid = os.stat(path).st_uid except (OSError, IOError): - return '' - - try: - return passwd_file[uid][0] - except KeyError: - return str(uid) + return '' + if IS_INSIDE_DOCKER: + try: + return passwd_file[uid][0] + except KeyError: + return str(uid) + else: + return pwd.getpwuid(uid)[0] class GPU: @@ -344,6 +355,14 @@ class GPU: def fb_memory_free(self): return self.root.find('fb_memory_usage').find('free').text.split()[0] + @handle_attr_error + def bar1_memory_used(self): + return self.root.find('bar1_memory_usage').find('used').text.split()[0] + + @handle_attr_error + def bar1_memory_free(self): + return self.root.find('bar1_memory_usage').find('free').text.split()[0] + @handle_attr_error def temperature(self): return self.root.find('temperature').find('gpu_temp').text.split()[0] @@ -399,6 +418,8 @@ class GPU: 'decoder_util': self.decoder_util(), 'fb_memory_used': self.fb_memory_used(), 'fb_memory_free': self.fb_memory_free(), + 'bar1_memory_used': self.bar1_memory_used(), + 'bar1_memory_free': self.bar1_memory_free(), 'gpu_temp': self.temperature(), 'graphics_clock': self.graphics_clock(), 'video_clock': self.video_clock(), -- cgit v1.2.3