Skip to content

Configure the built-in indicators

The health endpoint runs every indicator listed in health.indicators. Each key is the component name in the JSON. Each value is a class name, or a class name with constructor arguments:

'name' => IndicatorClass::class,
'name' => [IndicatorClass::class, ['argument' => 'value']],

The container builds the indicator and passes the arguments by name. The health indicators reference lists the arguments of each built-in indicator.

Delete its line, or comment it out. For example, to stop checking the cache:

config/actuator.php
'indicators' => [
'ping' => PingHealthIndicator::class,
'readinessState' => ReadinessStateHealthIndicator::class,
'diskSpace' => DiskSpaceHealthIndicator::class,
'db' => DatabaseHealthIndicator::class,
'cache' => CacheHealthIndicator::class,
],

If a health group still includes the removed name, the health endpoint throws an exception. Remove the name from the group too.

DatabaseHealthIndicator checks the default connection. Pass connection to check another one:

config/actuator.php
'db' => [DatabaseHealthIndicator::class, ['connection' => 'pgsql']],

Register the same indicator under several names:

config/actuator.php
'db' => DatabaseHealthIndicator::class,
'reportingDb' => [DatabaseHealthIndicator::class, ['connection' => 'reporting']],
'sessionsCache' => [CacheHealthIndicator::class, ['store' => 'redis']],

Each name becomes its own component, with its own status.

DiskSpaceHealthIndicator checks the disk that holds the application, and reports DOWN below 10 MB of free space. Pass path and threshold (in bytes) to change this:

config/actuator.php
'diskSpace' => [DiskSpaceHealthIndicator::class, [
'path' => storage_path(),
'threshold' => 1024 * 1024 * 1024, // 1 GB
]],

To watch a mounted volume as well, add a second entry:

config/actuator.php
'uploadsDisk' => [DiskSpaceHealthIndicator::class, ['path' => '/mnt/uploads']],

A path that does not exist reports DOWN, with exists: false.

The Redis indicator is off by default, because not every application uses Redis.

  1. Install a Redis client: the phpredis extension, or composer require predis/predis.

  2. Uncomment the indicator, or add it:

    config/actuator.php
    use Nwidart\Actuator\Health\Indicators\RedisHealthIndicator;
    'redis' => RedisHealthIndicator::class,
  3. To check a connection other than default, pass connection:

    config/actuator.php
    'redis' => [RedisHealthIndicator::class, ['connection' => 'cache']],

On your machine, show the details to see every indicator and its status:

.env
ACTUATOR_HEALTH_SHOW_DETAILS=always
Terminal window
curl http://localhost/actuator/health

Do not keep always in production. See show health details to authorized users.