This package makes it easy to monitor your Neos application vitals and outputs a JSON for Oh Dear.
You can easily install this plugin via composer
composer require wy/neos-oh-dear
- Create a file in the web root folder, e.g.
health.php
(see example below)- Require
../Packages/Plugins/Wysiwyg.OhDear/autoload.php
- Initialize the
\Wysiwyg\OhDear\Application
class with the Composer autoloader (see below for an example) - Initialize your checks with the correct configuration values
- Process the steps
- Require
- Configure your Oh Dear secret at the following config path in Neos:
Wysiwyg.OhDear.healthSecret
(only for production) - Open the file in your web browser, the result should be a JSON string (see example below)
<?php
use \Wysiwyg\OhDear\Checks;
$composerAutoloader = require_once '../Packages/Plugins/Wysiwyg.OhDear/autoload.php';
$app = new \Wysiwyg\OhDear\Application($composerAutoloader);
/** @var array<int, \Wysiwyg\OhDear\Checks\Check> $checks */
$checks = [
new Checks\DiskSpaceCheck(),
new Checks\CpuLoadCheck(),
new Checks\DatabaseCheck(
'mysql',
$app->getNeosConfig('Neos.Flow.persistence.backendOptions.host'),
$app->getNeosConfig('Neos.Flow.persistence.backendOptions.user'),
$app->getNeosConfig('Neos.Flow.persistence.backendOptions.password'),
$app->getNeosConfig('Neos.Flow.persistence.backendOptions.dbname')
),
new Checks\RedisCheck(
$app->getNeosConfig('Neos_Fusion_Content.backendOptions.hostname', 'Caches'),
$app->getNeosConfig('Neos_Fusion_Content.backendOptions.password', 'Caches'),
$app->getNeosConfig('Neos_Fusion_Content.backendOptions.database', 'Caches'),
(int) $app->getNeosConfig('Neos_Fusion_Content.backendOptions.port', 'Caches')
),
new Checks\SwiftSmtpCheck(
$app->getNeosConfig('Neos.SwiftMailer.transport.options.host'),
$app->getNeosConfig('Neos.SwiftMailer.transport.options.encryption'),
$app->getNeosConfig('Neos.SwiftMailer.transport.options.port'),
$app->getNeosConfig('Neos.SwiftMailer.transport.options.user'),
$app->getNeosConfig('Neos.SwiftMailer.transport.options.password'),
$app->getNeosConfig('Neos.SwiftMailer.transport.options.streamOptions'),
),
];
$app->process($checks);
{
"finishedAt": 1639735170,
"checkResults": [
{
"name": "Disk space",
"label": "",
"notificationMessage": "The disk is almost full (90% used).",
"shortSummary": "90%",
"status": "warning",
"meta": {
"disk_space_used_percentage": 90
}
},
{
"name": "CPU Load",
"label": "",
"notificationMessage": "",
"shortSummary": "3.31982421875 2.98046875 2.98046875",
"status": "ok",
"meta": {
"lastMinute": 3.31982421875,
"last5Minutes": 2.98046875,
"last15Minutes": 2.98046875
}
},
{
"name": "Database Connection",
"label": "",
"notificationMessage": "",
"shortSummary": "Conntected",
"status": "ok",
"meta": []
}
]
}