perfectwebteam/craft-ohdear-application-health

Oh Dear Application Health checker for Craft CMS.

1.1.0 2025-05-09 19:14 UTC

This package is not auto-updated.

Last update: 2025-05-09 19:17:32 UTC


README

Oh Dear Application Health checker icon

Oh Dear Application Health checker for Craft CMS

This plugin provides a Oh Dear Application Health checker Craft CMS.

🚦 Health Checks Overview

This plugin performs the following health checks and provides a JSON feed on yourwebsite.com/application-health.json for Oh Dear.

The response is cached for 5 minutes.

âś… Updates

Checks if updates are available for Craft CMS and installed plugins.

âś… Queue Status

Monitors the number of jobs in the queue and detects any failed jobs.

âś… Pending Migrations

Verifies if there are any unapplied database migrations.

âś… Error Logs

Counts recent errors in today’s log files (web.log, queue.log, console.log).

âś… Git Repository Status

Checks if a .git repository exists and whether there are uncommitted changes.

âś… Security Headers

Fetches site headers and verifies the presence of key security headers (e.g., CSP, HSTS, X-Frame-Options).

âś… Project Config Status

Confirms if the project configuration is fully synchronized.

âś… PHP Version

Reports the active PHP version running on the server and verifies against a minimum required version.

âś… Admin Users

Lists all admin users and flags users who haven’t logged in for a configurable period.

Requirements

This plugin requires Craft CMS 4.0.0+ or 5.0.0+.

Installation

You can install this plugin from the Plugin Store or with Composer.

From the Plugin Store

Go to the Plugin Store in your project’s Control Panel and search for “Oh Dear Application Health”. Then click on the “Install” button in its modal window.

With Composer

Open your terminal and run the following commands:

# go to the project directory
cd /path/to/my-project.test

# tell Composer to load the plugin
composer require perfectwebteam/craft-ohdear-application-health

# tell Craft to install the plugin
./craft plugin/install ohdear-application-health

Setup

Once Oh Dear Application Health is installed:

  1. Go to your site in Oh Dear and activate the Application health check.
  2. Set the Health Report URL to https://www.yourdomain.com/application-health.json.
  3. Copy the Health Report Secret value and set it as value for OH_DEAR_HEALTH_REPORT_SECRET= in your .env file.
  4. Optionally add a config/ohdear-application-health.php configuration file in which you can override the default settings.

Example configuration:

<?php

return [
    'checks' => [
        'addUpdateCheck' => true,
        'addQueueCheck' => true,
        'addPendingMigrationsCheck' => true,
        'addProjectConfigCheck' => true,
        'addErrorLogCheck' => true,
        'addGitChangesCheck' => true,
        'addSecurityHeadersCheck' => true,
        'addPhpVersionCheck' => true,
        'addAdminUsersCheck' => true,
    ],
    'oldestUpdateWarningDays' => 30,
    'minimumPhpVersion' => '8.1.0',
    'requiredSecurityHeaders' => [
        'Content-Security-Policy',
        'X-Frame-Options',
        'Strict-Transport-Security',
        'X-Content-Type-Options',
        'Referrer-Policy',
        'Permissions-Policy',
    ],
    'inactiveAdminThreshold' => '-1 year',
    'gitRepoPath' => '@root',
	'queueTotalThreshold' => 10,
	'queueFailedThreshold' => 2
];

Brought to you by Perfect Web Team