integer-net/magento2-health-check

Magento 2 Health Check

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 3

Watchers: 0

Forks: 0

Open Issues: 0

Type:magento2-component

pkg:composer/integer-net/magento2-health-check

1.1.0 2025-11-18 00:15 UTC

This package is auto-updated.

Last update: 2025-11-19 16:08:22 UTC


README

Installation

Using composer

When this package is installed into a Magento 2 project (with the default magento/magento-composer-installer plugin present), it will auto install the required files into the pub/ directory of Magento 2

composer require integer-net/magento2-health-check

Manual

Copy the file src/health_check.php into your Magento 2 directory into pub/ (replace the original health_check.php from Magento 2)

Configuration

The health check can be configured by creating the file pub/check/config.php. All configuration options can be found in the provided default configuration, which will be installed into pub/check/config.dist.php. When a config.php is present, it will be loaded instead of the config.dist.php.

The contents of the file should look like this:

<?php

declare(strict_types=1);

use IntegerNet\Healthcheck\Configuration;

return (new Configuration)
    // Default timezone: Europe/Berlin
    // ->setTimezone('Antarctica/Troll')
    // Default output format: Configuration::FORMAT_PLAIN
    // Available output formats: Configuration::FORMAT_JSON & Configuration::FORMAT_PLAIN
    // ->setOutputFormat(Configuration::FORMAT_JSON)
    ->testProductionMode(/* enabled: true */)
    ->testDatabaseConnections(/* enabled: true, connections: ['default', 'erp'] */)
    ->testCacheAvailability(/* enabled: true, caches: ['configuration', 'full_page'] */)
    ->testIndexerTriggersExist(/* enabled: true, indexers: ['catalogsearch_fulltext', 'catalogrule_rule'] */)
    ->testCronjobsAreRunning(/* enabled: true, */ groups: [
        ['group' => 'index', 'maxOffset' => 5], // 'maxOffset' in minutes since last run
        ['group' => 'default', 'maxOffset' => 5],
        ['group' => 'consumers', 'maxOffset' => 5],
    ])
;

See config.dist.php for a list of all possible configurations and their parameters

Output format

Allowed formats: plain, json

The default output format can be changed by using the method setOutputFormat in the configuration file (pub/check/config.php) or by setting the environment variable HEALTHCHECK_OUTPUT_FORMAT.

Example usage:

HEALTHCHECK_OUTPUT_FORMAT=plain php pub/health_check.php

Supported checks

  • Production mode is set
  • Database availability
  • Cache backend availability (if backend is not 'file')
  • Indexer triggers exist in database
  • Cronjobs are running (per group)
  • Search backend/engine availability
  • Queue backend availability (if amqp is used)