Improve ethtool parsing speeds

This commit is contained in:
Joshua Boniface 2023-02-14 15:49:58 -05:00
parent e29d0e89eb
commit ca91be51e1
1 changed files with 2 additions and 2 deletions

View File

@ -69,7 +69,7 @@ class MonitoringPluginScript(MonitoringPlugin):
# Run any imports first # Run any imports first
import daemon_lib.common as common import daemon_lib.common as common
from re import match, search from re import match, search, findall
messages = list() messages = list()
health_delta = 0 health_delta = 0
@ -150,7 +150,7 @@ class MonitoringPluginScript(MonitoringPlugin):
in_modes = False in_modes = False
break break
if in_modes: if in_modes:
speed = int(line.split()[-1].replace('baseT', '').split('/')[0]) speed = int(findall(r'\d+', line.split()[-1])[0])
supported_link_speeds.add(speed) supported_link_speeds.add(speed)
else: else:
# Get ethtool supported speeds for interface # Get ethtool supported speeds for interface