summaryrefslogtreecommitdiffstats
path: root/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py
diff options
context:
space:
mode:
Diffstat (limited to 'collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py')
-rw-r--r--collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py33
1 files changed, 27 insertions, 6 deletions
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:
@@ -345,6 +356,14 @@ class GPU:
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(),