Skip to content

Commit

Permalink
frontend network naming bugfix (#75)
Browse files Browse the repository at this point in the history
Co-authored-by: Ubuntu <rafsalas@ndv4.ydru00tc21wuzf2z1e23k3cpig.jx.internal.cloudapp.net>
  • Loading branch information
rafsalas19 and Ubuntu authored Jan 10, 2024
1 parent c7dc48b commit 39e1903
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/worker/exporters/node_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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':
Expand Down

0 comments on commit 39e1903

Please sign in to comment.