Skip to main content

Health check

mc-dm:health-check runs eight named probes against the addon's runtime and reports pass / warn / fail per probe. Probe names are stable, output is line-oriented, and the command exits non-zero when any probe fails — feed it straight to a monitoring script.

php cmd.php mc-dm:health-check

Sample output:

PASS addon_active active
PASS storage_mount_writable round-trip OK
PASS db_schema_sync 27 xf_mc_dm_* tables present
PASS db_columns_sync 7 entity selects ok
PASS job_queue_depth 0 addon jobs queued
PASS cron_schedule 7 active crons scheduled
PASS registry_loadable 4/4 registries loaded
PASS option_sanity 2 required options present

Probes

NameWhat it checkswarn conditionfail condition
addon_activeThe addon is installed and not disabledxf_addon row missing or active = 0
storage_mount_writableA file written through internal-data://mc-downloads/ can be read back and deletedWrite threw, or the round-trip read returned nothing
db_schema_syncAll addon tables existFewer than 14 xf_mc_dm_* tables present
db_columns_syncEach entity selects without a column-not-found errorAt least one entity throws on SELECT
job_queue_depthBacklog of addon-owned jobs in xf_jobMore than 0 jobs queued
cron_scheduleAddon cron entries are active and not stuckA cron's next_run is more than 7 days in the past
registry_loadableAll four extension registries (Gate, Processor, Source, Stats) instantiate cleanlyAny registry throws during construction
option_sanityRequired options resolve to a valueAny required option is missing or empty

Exit codes

  • 0 — every probe passed (or warned).
  • 1 — at least one probe reported fail.

warn does not affect the exit code. A backlog of jobs or a slightly stale cron is not necessarily an outage; it is information for the operator.

Wiring into monitoring

Cron the command at whatever interval matches your alerting tolerance and pipe the output to your log shipper:

*/5 * * * * cd /var/www/forum && php cmd.php mc-dm:health-check >> /var/log/mc-dm-health.log 2>&1

For pull-based monitoring (Nagios, Sensu, Zabbix), shell out to the command and treat the exit code as the check state. The line-oriented output is parseable with awk '$1 == "FAIL"' if you want per-probe alerting downstream.