Calculate an overall server health score from CPU, memory, disk and service uptime metrics.
This composite health score starts from a perfect 100 and subtracts weighted penalties for each metric that exceeds a healthy 70% comfort threshold: load average per core, memory utilization and disk utilization are penalized proportionally once past that threshold, while each failed systemd service (which typically signals an outright application or configuration problem rather than gradual resource pressure) subtracts a flat 10 points, reflecting that even one failed service is a concrete issue worth immediate attention rather than a gradual capacity concern.
Load, memory and disk penalties
penalty = max(0, metric% − 70) × weight
Health score
health_score = 100 − (load_penalty + memory_penalty + disk_penalty + failed_services × 10)
Memory exhaustion tends to cause more abrupt and severe failures than CPU or disk pressure — once physical memory and swap are exhausted, the OOM killer starts terminating processes somewhat unpredictably, whereas high CPU load and disk usage typically degrade performance more gracefully before causing outright failures.
A failed systemd unit represents a definite, binary problem (something is not running that should be) rather than a gradient of resource pressure, so it is modeled as a fixed penalty per occurrence rather than scaling with a percentage — multiple failed services compound linearly since each represents an independent concrete issue.
Yes — a healthy, well-provisioned server sitting comfortably under the 70% thresholds on load, memory and disk with zero failed services scores a perfect 100 under this model, which is intentional: the score is designed so that normal, non-alarming operation reads as fully healthy rather than being artificially deflated.