Explicitly round load avg in load plugin

This commit is contained in:
Joshua Boniface 2023-09-16 22:58:49 -04:00
parent 457b7bed3d
commit fa8329ac3d
1 changed files with 3 additions and 3 deletions

View File

@ -72,13 +72,13 @@ class MonitoringPluginScript(MonitoringPlugin):
from psutil import cpu_count from psutil import cpu_count
# Get the current 1-minute system load average # Get the current 1-minute system load average
load_average = getloadavg()[0] load_average = float(round(getloadavg()[0], 2))
# Get the number of CPU cores # Get the number of CPU cores
cpu_cores = cpu_count() cpu_cores = float(cpu_count())
# Check that the load average is greater or equal to the cpu count # Check that the load average is greater or equal to the cpu count
if load_average > float(cpu_cores): if load_average > cpu_cores:
# Set the health delta to 10 (subtract 10 from the total of 100) # Set the health delta to 10 (subtract 10 from the total of 100)
health_delta = 50 health_delta = 50
# Craft a message that can be used by the clients # Craft a message that can be used by the clients