Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Richardvdketterij committed Feb 14, 2024
1 parent e4ae4a6 commit 3a43289
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,20 @@ def run(self, stat):
cpu_percentages = self._get_average_reading()
cpu_average = sum(cpu_percentages) / len(cpu_percentages)

stat.add(f"CPU Load Average {cpu_average:.2f}")
stat.add(f'CPU Load Average {cpu_average:.2f}')

warn = False
for idx, cpu_percentage in enumerate(cpu_percentages):
stat.add(f"CPU {idx} Load: {cpu_percentage:.2f}")
stat.add(f'CPU {idx} Load: {cpu_percentage:.2f}')
if cpu_percentage > self._warning_percentage:
warn = True

if warn:
stat.summary(DiagnosticStatus.WARN,
f"At least one CPU exceeds {self._warning_percentage} percent")
f'At least one CPU exceeds {self._warning_percentage} percent')
else:
stat.summary(DiagnosticStatus.OK,
f"CPU Average {cpu_average:.2f} percent")
f'CPU Average {cpu_average:.2f} percent')

return stat

Expand All @@ -92,7 +92,7 @@ def main(args=None):

# Create the node
hostname = socket.gethostname()
node = Node(f"cpu_monitor_{hostname.replace('-', '_')}")
node = Node(f'cpu_monitor_{hostname.replace('-', '_')}')

# Declare and get parameters
node.declare_parameter('warning_percentage', 90)
Expand Down

0 comments on commit 3a43289

Please sign in to comment.