hamzi/corewatch
CoreWatch is a zero-dependency DevOps dashboard for Laravel that reads /proc directly to monitor CPU, RAM, and disk, streams huge logs with O(1) memory, runs whitelisted commands safely, sends alerts, and exposes a health endpoint.
SystemDoctor diagnostics service: php artisan corewatch:doctor and the programmatic CoreWatch::doctor() / CoreWatchManager::doctor() API add a pre-flight and runtime health-check capability across System, Database, Cache, Queue, Scheduler, Alerts, and Security. This is architecturally significant: the package now exposes a machine-readable health surface, which makes it usable as a deployment gate and as a liveness/readiness probe rather than purely a human-facing dashboard. It is also the first API in the package that is useful in CI without a browser.SendQueuedAlertJob (ShouldQueue, backoff retries, queue selectable via COREWATCH_NOTIFICATIONS_QUEUE) moves alert delivery off the request path. This is a correct architectural direction (alerting should never block a request), but it introduces a hard runtime dependency on a functioning queue worker for alert delivery — a shift from "alerts are synchronous side effects" to "alerts are a background pipeline."corewatch:test-alert: An interactive diagnostic command that verifies Slack and Telegram channel delivery end-to-end. This materially de-risks the single most failure-prone part of any observability rollout (silently misconfigured alert channels) and shortens the "is it wired up correctly?" validation loop from a production incident to a one-minute CLI check.\Exception to \Throwable. Practically, this means PHP Errors (TypeError, out-of-memory-adjacent fatals, bad method calls) no longer propagate out of the observability layer into user requests. For a TPM this is the difference between "monitoring package can take down checkout" and "monitoring package degrades quietly."doctor() can be called from an external prober, but the prober is still your own app.)doctor command explicitly reports on Security, which gives a verification hook for this control rather than relying on code review.\Throwable as a double-edged sword: Catching all Throwables prevents application crashes, but can convert loud failures into quiet ones. If the package swallows an Error without logging at an appropriate level, you lose signal about your observability layer being broken. Mitigation: verify what the package logs when it catches; add an alert on "collector error" events if exposed.COREWATCH_NOTIFICATIONS_QUEUE point to, who owns its worker supervision, and what happens to alerts during a deploy that drains workers?Throwable and is caught, where does that surface? Do we get a log entry, a metric, or nothing?CoreWatch::doctor() back our /health endpoint or a synthetic external probe, and what is its own runtime cost?corewatch:doctor as a pre-cutover gate in staging and production?Best Fit For:
doctor + test-alert make the package CI-adjacent for the first time).Stack Requirements:
| Component | Compatibility | Notes |
|---|---|---|
| Laravel | 10.x+ (PHP 8.1+) | Uses Laravel’s service container. |
| PHP Extensions | pcntl, posix (for process metrics) |
May need enabling on shared hosting. |
| Database | MySQL, PostgreSQL, SQLite | Alert history stored in DB. |
| Cache | Redis, Memcached, Database | Metrics caching layer. |
| Queues | Database, Redis, SQS | Async log processing and (2.2.0) async alert jobs. |
| Scheduler | Laravel scheduler | Required for health/recurring checks per 2.2.0 doctor. |
| Filament | v3.x | UI integration. |
| Queue worker | Supervisor / Horizon | Now required for alert delivery (2.2.0). |
Anti-Patterns:
composer require hamzi/corewatch:^2.2.config/corewatch.php; set COREWATCH_NOTIFICATIONS_QUEUE explicitly rather than relying on defaults.php artisan corewatch:doctor immediately post-install to establish a baseline and catch missing PHP extensions/permissions early.php artisan corewatch:test-alert.top/htop, queue depth) during peak load.corewatch:doctor (or CoreWatch::doctor()) as a recurring check and alert on its failure — the observability layer should be able to report on itself.CoreWatch::doctor() programmatically in health endpoints, deploy scripts, and pipelines.laravel-debugbar) may duplicate metrics.pcntl, posix) enabled.php artisan vendor:publish --provider="Hamzi\CoreWatch\CoreWatchServiceProvider".config/corewatch.php incl. COREWATCH_NOTIFICATIONS_QUEUE.php artisan corewatch:doctor; resolve anything flagged under System, Database, Cache, Queue, Scheduler, Alerts, Security.config/corewatch.php.php artisan corewatch:test-alert (interactive feedback) — do this before enabling production thresholds.php artisan corewatch:tail.doctor's Security check.doctor() into a recurring health check.Throwable semantics in custom collectors).corewatch:doctor after infrastructure changes (new DB, cache driver swap, queue backend move).corewatch:doctor gives support/first-line a scripted diagnostic instead of escalating to engineering — a genuine tier-1 deflection win. corewatch:test-alert similarly converts "alerts aren't firing" from an engineering ticket into a self-service check.Throwable hardening means the dashboard failing should no longer take down user-facing features.corewatch:doctor as step zero.test-alert after any credential rotation.doctor reports a failed subsystem," "What to do if alerts stop arriving."doctor reports per-instance system state, so multi-instance deployments need per-instance invocation or aggregation.SendQueuedAlertJob to prevent cross-contamination with business jobs.log-max-files or custom cleanup.| Failure Scenario | Impact | Mitigation Strategy |
|---|---|---|
| App crash | Dashboard unavailable | External uptime probe; doctor() from outside the app where feasible. |
| Database unavailable | Alert history lost, dashboard degraded | Replicate alert data; doctor flags DB subsystem; alert on DB health. |
| Queue worker down (2.2.0) | Alerts silently delayed or lost | Supervise worker (Horizon/Supervisor); alert on queue depth/worker liveness; dead-letter review. |
| Misconfigured channel | Alerts fire but never arrive | corewatch:test-alert after every credential/config change. |
Collector throws an Error |
Observability silently degraded | Confirm catch path logs at warning+; surface via doctor and app-level alert. |
| Cache eviction / Redis bloat | Metrics gaps, stale dashboard | TTL tuning; separate cache store for metrics if needed. |
| Log volume growth | Disk exhaustion → app outage | Retention policy + scheduled purge; storage alerts. |
| Unauthorized dashboard access | Server metric/metadata exposure | Auth middleware + IP allowlist; verify via doctor Security check. |
How can I help you explore Laravel packages today?