diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-06-27 18:46:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-06-27 18:46:10 +0000 |
commit | 9abec302a4736c965a34b930f4f5bf2b1494bf6e (patch) | |
tree | aef24838cdda26750d86362b832263f4bcdf5a0e /collectors/python.d.plugin | |
parent | Adding upstream version 1.40.0. (diff) | |
download | netdata-9abec302a4736c965a34b930f4f5bf2b1494bf6e.tar.xz netdata-9abec302a4736c965a34b930f4f5bf2b1494bf6e.zip |
Adding upstream version 1.40.1.upstream/1.40.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-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: |