spatie/cpu-load-health-check
Laravel Health check for monitoring CPU load. Configure thresholds (e.g., average load over the last 5 minutes) and get notifications when load is too high. Integrates seamlessly with spatie/laravel-health.
Pros:
Cons:
Laravel Ecosystem Fit:
failWhenLoadIsHigherInTheLast5Minutes), allowing fine-grained control.Non-Laravel Considerations:
Low Risk:
Mitigation Needs:
1.2 for 5 minutes may vary by workload).Primary Use Case:
Complementary Tools:
Anti-Patterns:
Assessment Phase:
top, htop, cloud provider metrics) to define baseline thresholds.Implementation:
composer require spatie/cpu-load-health-check
AppServiceProvider):
Health::checks([
CpuLoadCheck::new()->failWhenLoadIsHigherInTheLast5Minutes(1.2),
]);
config/health.php.Testing:
stress-ng) to confirm alerts fire.Rollout:
sys extension (for CPU stats), which is enabled by default.Phase 1: Basic Integration
Phase 2: Optimization
Phase 3: Scaling
Pros:
failWhenLoadIsHigherInTheLast5Minutes(1.2)).Cons:
Troubleshooting:
sys extension is enabled and the health check has permissions to read /proc/stat.SLA Considerations:
warn at 1.0 load, critical at 1.5).Horizontal Scaling:
Performance Impact:
Cost Implications:
| Failure Scenario | Impact | Mitigation |
|---|---|---|
| High CPU load (true positive) | Service degradation | Auto-scale, optimize queries, or kill rogue processes. |
| False positive alerts | Alert fatigue | Tune thresholds, add context (e.g., ignore |
How can I help you explore Laravel packages today?