Linux 软件免费装
Banner图

Klarsmith Ops Kit

开发者 klarsmith
更新时间 2026年9月10日 16:36
PHP版本: 8.3 及以上
WordPress版本: 7.1
版权: GPLv2 or later
版权网址: 版权信息

标签

logging monitoring kubernetes prometheus health-check

下载

0.1.7

详情介绍:

WordPress has no honest health endpoint. The front page, admin-ajax.php and the usual health.php stubs all return 200 while the database is down, the object cache is gone, or WordPress is serving its "database update required" interstitial. Every probe in common use calls that pod ready. Klarsmith Ops Kit gives a containerised WordPress site three things operators actually need: The plugin fails closed. /metrics is disabled until a token is configured, and the anonymous readiness response names failing checks without leaking detail. Configuration is by environment variable, which is how containers are configured: WP-CLI commands: wp ops check (exit 1 on any failing check), wp ops collect (refresh the snapshot), wp ops metrics (print the exposition locally). Source, issue tracker and Kubernetes manifests for probes, the collector CronJob and scraping live at https://github.com/klarsmith/wp-ops-kit.

安装:

  1. Install from the WordPress plugin directory, or with Composer (composer require klarsmith/wp-ops-kit; the Composer package installs as wp-content/plugins/wp-ops-kit).
  2. Activate the plugin.
  3. Point your readiness probe at /wp-json/ops/v1/readyz.
  4. Run wp ops collect on a schedule (a five-minute CronJob is the reference setup).
  5. Set WP_OPS_TOKEN and scrape /wp-json/ops/v1/metrics with that bearer token.
If a security plugin blocks anonymous REST requests, the plugin allows its own ops/v1 namespace through at priority 1 unless WP_OPS_REST_BYPASS_AUTH=false. Add ops to the security plugin's allowlist as well where it has one.

升级注意事项:

0.1.7 Name change only; no configuration changes.

常见问题:

Why not use the front page as the readiness probe?

Because it returns 200 while the site is broken. The database-upgrade interstitial, a missing object cache and a read-only uploads volume all serve a 200 front page.

Why does readiness not cover liveness too?

If liveness consulted the database, one database blip would fail liveness on every pod of every site at once and restart-storm the fleet. Readiness drains; liveness restarts. Only readiness should depend on WordPress.

Why is /metrics computed from a snapshot?

Walking the cron array and summing autoloaded option sizes on every scrape would load a shared database for no benefit. The collector does the work once; scrapes read the result. If the collector dies the snapshot age climbs, which is alertable.

Does it work behind WPML or a language prefix?

Yes. Route detection uses the REST route query variable with a request-URI fallback, so /en/wp-json/ops/v1/readyz works the same as /wp-json/ops/v1/readyz.

更新日志:

0.1.7 0.1.6 0.1.3 0.1.2 0.1.1 0.1.0