Skip to content
This repository has been archived by the owner on Mar 5, 2024. It is now read-only.

Commit

Permalink
Fix the unit names
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Safar committed Mar 23, 2021
1 parent 1f5ed73 commit 500aa2f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ethtool-exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ def __init__(self, args=None):
'extended_identifier',
'connector',
'transceiver_type',
'length_smf,km',
'length_smf_km',
'length_smf',
'length_50um',
'length_62.5um',
'length_62_5um',
'length_copper',
'length_om3',
'laser_wavelength',
Expand Down Expand Up @@ -307,6 +307,8 @@ def add_split(self, sensors, iface, key, value):
"""Helper method to split values like '10.094 mA'"""
val, unit = value.split(' ', 1)
unit = unit.replace(' ', '_')
unit = unit.replace('.', '_')
unit = unit.replace(',', '_')
labels = [iface, key + '_' + unit]
sensors.add_metric(labels=labels, value=float(val))

Expand Down

0 comments on commit 500aa2f

Please sign in to comment.