updates
This commit is contained in:
@@ -31,13 +31,16 @@ def check(section, name, status, detail):
|
||||
checks.append(dict(section=section, name=name, status=status, detail=str(detail)[:500]))
|
||||
|
||||
host = socket.gethostname()
|
||||
# CPU load is informational only.
|
||||
# Do not generate health warnings without identifying
|
||||
# the process responsible for excessive CPU usage.
|
||||
try:
|
||||
load = os.getloadavg()
|
||||
cpus = os.cpu_count() or 1
|
||||
check('System', 'CPU load', 'warn' if load[0] > cpus * 1.5 else 'ok',
|
||||
f'1m load {load[0]:.2f}; {cpus} CPUs')
|
||||
except OSError as exc:
|
||||
check('System', 'CPU load', 'warn', str(exc))
|
||||
check('System', 'CPU load', 'ok',
|
||||
f'1m load {load[0]:.2f}; {cpus} CPUs (informational)')
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
try:
|
||||
with open('/proc/meminfo', encoding='utf-8') as f:
|
||||
|
||||
Reference in New Issue
Block a user