From 39e1903e27c8ff02d8c30798f496be62ae133ada Mon Sep 17 00:00:00 2001 From: rafsalas19 <70273488+rafsalas19@users.noreply.github.com> Date: Wed, 10 Jan 2024 14:50:57 -0500 Subject: [PATCH] frontend network naming bugfix (#75) Co-authored-by: Ubuntu --- src/worker/exporters/node_exporter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/worker/exporters/node_exporter.py b/src/worker/exporters/node_exporter.py index 0eb2509..378d48f 100644 --- a/src/worker/exporters/node_exporter.py +++ b/src/worker/exporters/node_exporter.py @@ -101,7 +101,7 @@ def collect(self, field_name): # noqa: C901 '''Custom collection Method''' value = None if 'net' in field_name: - cmd = "grep 'eth0' " + self.config['fieldFiles'][field_name] + cmd = "grep '{}' ".format(config['ethernet_device']) + self.config['fieldFiles'][field_name] val = None if 'net_rx' in field_name: val = shell_cmd(cmd, 5).split()[1] @@ -322,7 +322,7 @@ def init_config(job_id, port=None, ethernet_device='eth0'): config['fieldFiles'][field_name] = '/proc/net/dev' # initialize counter, this will ensure a initial value is present # to calculate bandwidth - cmd = "grep 'eth0' " + config['fieldFiles'][field_name] + cmd = "grep '{}' ".format(config['ethernet_device']) + config['fieldFiles'][field_name] if field_name == 'net_rx': config['counter'][field_name] = shell_cmd(cmd, 5).split()[1] elif field_name == 'net_tx':