cpu_status loop added

This commit is contained in:
2025-11-23 22:29:44 +01:00
parent a1aca26b19
commit 2d911cee99
+8 -7
View File
@@ -40,12 +40,13 @@ def main():
status = 0
status_str = "OK"
if percent_used >= args.critical:
status = 2
status_str = "CRITICAL"
elif percent_used >= args.warning:
status = 1
status_str = "WARNING"
for percent_used in cpu:
if percent_used >= args.critical:
status = 2
status_str = "CRITICAL"
elif percent_used >= args.warning:
status = 1
status_str = "WARNING"
# Perfdata: used and total in MiB, and percent
perf = (
@@ -53,7 +54,7 @@ def main():
f" total={total_mb:.1f}MiB"
)
print(f"MEMORY {status_str} - {used_mb:.1f}MiB used of {total_mb:.1f}MiB ({percent_used:.1f}%) | {perf}")
print(f"CPU {status_str} - {used_mb:.1f}MiB used of {total_mb:.1f}MiB ({percent_used:.1f}%) | {perf}")
sys.exit(status)