To use monitoring in your web or console application you need to append controller reference to your controller map.
<?php
// config.php
use Horat1us\Yii\Monitoring;
return [
'controllerMap' => [
'monitoring' => [
'class' => Monitoring\Web\Controller::class,
'controls' => [
// here paste your controls references
'id' => Monitoring\ControlInterface::class,
],
],
],
];
<?php
// config.php
use Horat1us\Yii\Monitoring;
return [
'controllerMap' => [
'health-check' => [
'class' => Monitoring\Console\Controller::class,
'controls' => [
// here paste your controls references
'id' => Monitoring\ControlInterface::class,
],
],
],
];
Then use:
php yii health-check # Execute all controls
php yii health-check/execute id # Execute single control
Not zero return code will be returned in case some control failed.
Tip: you may use to monitor Docker container
See usage documentation for built-in controls details.