From 9abec302a4736c965a34b930f4f5bf2b1494bf6e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 27 Jun 2023 20:46:10 +0200 Subject: Adding upstream version 1.40.1. Signed-off-by: Daniel Baumann --- .../python.d.plugin/nvidia_smi/nvidia_smi.chart.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'collectors/python.d.plugin') 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 = '' @@ -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: -- cgit v1.2.3