diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-06-27 18:46:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-06-27 18:46:20 +0000 |
commit | c933bf105b0de89e3fd524517daf163a16dd0d44 (patch) | |
tree | 50cb525f946e4ac65a416178766e2e124167a40f /collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py | |
parent | Releasing debian version 1.40.0-2. (diff) | |
download | netdata-c933bf105b0de89e3fd524517daf163a16dd0d44.tar.xz netdata-c933bf105b0de89e3fd524517daf163a16dd0d44.zip |
Merging upstream version 1.40.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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.py | 17 |
1 files changed, 10 insertions, 7 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 6affae7b8..271c99638 100644 --- a/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py +++ b/collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py @@ -17,6 +17,8 @@ disabled_by_default = True NVIDIA_SMI = 'nvidia-smi' +NOT_AVAILABLE = 'N/A' + EMPTY_ROW = '' EMPTY_ROW_LIMIT = 500 POLLER_BREAK_ROW = '</nvidia_smi_log>' @@ -481,13 +483,14 @@ class GPU: 'power_draw': self.power_draw(), } - pci_bw_max = self.pci_bw_max() - if not pci_bw_max: - data['rx_util_percent'] = 0 - data['tx_util_percent'] = 0 - else : - data['rx_util_percent'] = str(int(int(self.rx_util())*100/self.pci_bw_max())) - data['tx_util_percent'] = str(int(int(self.tx_util())*100/self.pci_bw_max())) + if self.rx_util() != NOT_AVAILABLE and self.tx_util() != NOT_AVAILABLE: + pci_bw_max = self.pci_bw_max() + if not pci_bw_max: + data['rx_util_percent'] = 0 + data['tx_util_percent'] = 0 + else: + data['rx_util_percent'] = str(int(int(self.rx_util()) * 100 / self.pci_bw_max())) + data['tx_util_percent'] = str(int(int(self.tx_util()) * 100 / self.pci_bw_max())) for v in POWER_STATES: |