Healthchecks
RunHealthcheckJob runs HealthcheckService::run() for each site. The service checks HTTP availability, SSL expiration, WordPress version, and pending plugin updates. It prefers data from the WP Hoster Agent health endpoint when available; otherwise falls back to WP-CLI.
Checks performed
- HTTP — GET
https://{fqdn}, record status code and TTFB. If unreachable or 5xx, status =down, critical alert raised. - SSL —
getSslDaysLeft()viastream_socket_clientandopenssl_x509_parse. If < 14 days, warning alert. - WordPress / plugins — If agent is enabled and token exists,
fetchAgentHealthData()GETs/wp-json/wphoster/v1/healthand useswp_version, etc. Otherwise WP-CLIcore versionandplugin list --update=available --format=count(cached).
Key file
app/Services/Healthchecks/HealthcheckService.php
run(Site)— Runs all checks, createsHealthcheckRunwith status, http_status, ttfb_ms, ssl_days_left, wp_version, pending_updates_count, details_jsonfetchAgentHealthData(Site)— GET health endpoint withX-WPHoster-Token; returns parsed JSON or nullgetSslDaysLeft(fqdn)— Connects to ssl://fqdn:443, reads peer cert, parses validTo, returns days left
Scheduling
wphoster:run-healthchecks runs every 10 minutes (see routes/console.php).
Alerts
| Condition | Severity |
|---|---|
| Site unreachable or 5xx | critical |
| SSL expires in < 14 days | warning |
| WP-CLI query fails | warning |