# elgentos/magento2-oh-dear-checks

> Magento 2 module for Oh Dear checks integration.

`composer require elgentos/magento2-oh-dear-checks`

Canonical URL: https://packagento.com/elgentos/magento2-oh-dear-checks

## At a glance

- **Vendor**: elgentos (https://packagento.com/elgentos.md)
- **Latest version**: 0.3.0 — released 2025-09-30
- **Pricing**: Free
- **Package type**: Magento 2 module
- **Status**: active, accepting new buyers

## Installation

Packagento is licence-gated, so even free packages need a licence on a project before Composer can resolve them.

1. **Sign in or create an account** at https://packagento.com/customer/account/.

2. **Add the package to your account.** Open https://packagento.com/elgentos/magento2-oh-dear-checks and complete the free checkout. A licence is minted automatically.

3. **Create or pick a project, then activate the licence on it.**
   - Projects represent the Magento installs you deploy to. Manage them at https://packagento.com/projects/.
   - Activate the new licence on the project you'll deploy this package to. Activation is what generates the Composer credentials scoped to that project.

4. **Add the project credentials to your Magento codebase.**

   Grab the project's public + private key from https://packagento.com/projects/ (open the project, then its Credentials tab), and add them to `auth.json`:

   ```json
   {
     "http-basic": {
       "packagento.com": {
         "username": "ppk_live_...",
         "password": "psk_live_..."
       }
     }
   }
   ```

   Add the Packagento Composer repository to `composer.json`:

   ```json
   {
     "repositories": [
       { "type": "composer", "url": "https://packagento.com" }
     ]
   }
   ```

5. **Install and apply.**

   ```bash
   composer require elgentos/magento2-oh-dear-checks:*
   bin/magento setup:upgrade
   bin/magento setup:di:compile
   bin/magento cache:flush
   ```

## What it does

Magento 2 module for Oh Dear checks integration.

## README

This Magento 2 module extends the [Vendic OhDear module](https://github.com/vendic/magento2-oh-dear) with additional application health checks.

### Installation

```bash
composer require elgentos/magento2-oh-dear-checks
bin/magento module:enable Elgentos_OhDearChecks
bin/magento setup:upgrade
```

### Available Checks

#### Sansec Shield Security Check

This check verifies that the Sansec Shield security extension is properly installed, enabled, and configured:

- **Module Installation**: Checks if the `Sansec_Shield` module is installed
- **Module Enablement**: Verifies the module is enabled via `sansec_shield/general/enabled` configuration
- **License Configuration**: Ensures a license key is configured via `sansec_shield/general/license_key`

**Check Results:**
- ✅ **OK**: Module is installed, enabled, and has a license key configured
- ⚠️ **WARNING**: Module is installed and enabled but license key is missing
- ❌ **FAILED**: Module is not installed or not enabled

#### Indexer Backlog Check

This check monitors the backlog size for all scheduled indexers in your Magento store:

- **Backlog Monitoring**: Tracks the number of pending items for each scheduled indexer
- **Status Tracking**: Reports the current status of each indexer

**Check Results:**
- ✅ **OK**: All indexers are up to date or have minimal backlog (< 1,000 items)
- ⚠️ **WARNING**: High backlog detected (1,000 - 9,999 items)
- ❌ **FAILED**: Critical backlog detected (≥ 10,000 items)

**Metadata Includes:**
- Backlog size per indexer
- Maximum backlog across all indexers
- Number of indexers with backlog

#### HTTP Cache Hosts Check

This check verifies that HTTP cache hosts (Varnish) are properly configured for cache clearing:

- **Configuration Check**: Verifies that `http_cache_hosts` is configured in `env.php`
- **Validation**: Ensures at least one host is configured with both `host` and `port` parameters

**Check Results:**
- ✅ **OK**: HTTP cache hosts are properly configured
- ❌ **FAILED**: HTTP cache hosts are not configured or misconfigured

**Metadata Includes:**
- Configuration status
- Number of configured hosts
- List of configured hosts (without sensitive details)

**Example Configuration in env.php:**
```php
'http_cache_hosts' => [
    [
        'host' => '127.0.0.1',
        'port' => '6081'
    ]
]
```

### Configuration

You can disable any check by adding configuration to your `env.php`:

```php
'ohdear' => [
    'Elgentos\\OhDearChecks\\Checks\\SansecShield' => [
        'enabled' => false
    ],
    'Elgentos\\OhDearChecks\\Checks\\IndexerBacklog' => [
        'enabled' => false,
        // Optional: customize which indexers to check
        'indexer_ids' => [
            'catalog_product_price',
            'catalog_category_product',
            'catalogsearch_fulltext',
            // ... add or remove indexer IDs as needed
        ],
        // Optional: global default thresholds (used when no per-indexer threshold is set)
        'warning_threshold' => 1000,
        'critical_threshold' => 10000,
        // Optional: per-indexer thresholds (override global defaults)
        'thresholds' => [
            'catalog_product_price' => [
                'warning' => 500,
                'critical' => 5000
            ],
            'catalogsearch_fulltext' => [
                'warning' => 2000,
                'critical' => 15000
            ],
            // ... configure thresholds for specific indexers
        ]
    ],
    'Elgentos\\OhDearChecks\\Checks\\HttpCacheHosts' => [
        'enabled' => false
    ]
]
```

#### Indexer Backlog Configuration Options

- **`indexer_ids`** (array): List of indexer IDs to monitor. If not specified, a default list of 10 common indexers is used.
- **`warning_threshold`** (int): Global warning threshold. Default: 1,000 items. Used when no per-indexer threshold is configured.
- **`critical_threshold`** (int): Global critical threshold. Default: 10,000 items. Used when no per-indexer threshold is configured.
- **`thresholds`** (array): Per-indexer threshold configuration. Each indexer can have its own `warning` and `critical` values that override the global defaults.

**Priority Order:**
1. Per-indexer threshold (if configured)
2. Global threshold (if configured)
3. Default threshold (1,000 for warning, 10,000 for critical)

### Contributing

Feel free to submit pull requests with additional security and health checks for Magento 2.

## Recent Versions

| Version | Released |
|---|---|
| 0.3.0 | 2025-09-30 |
| 0.2.0 | 2025-09-30 |
| 0.1.0 | 2025-09-23 |
| 0.0.10 | 2025-06-30 |
| 0.0.9 | 2025-02-13 |
| 0.0.8 | 2024-12-10 |
| 0.0.7 | 2024-12-09 |
| 0.0.6 | 2024-12-08 |
| 0.0.5 | 2024-12-06 |
| 0.0.4 | 2024-12-06 |

Showing 10 of 13 versions. Full release history on https://packagento.com/elgentos/magento2-oh-dear-checks.

## Dependencies

### Require

| Package | Constraint |
|---|---|
| vendic/magento2-oh-dear-checks | ^1.8 |

## Quality

Latest release (0.3.0) fails the Packagento QA pipeline. Verdicts below are per-cell (Magento line × PHP version) for the matrixed tools, and run-once for the static / security tiers.


### Compatibility

Each Magento line is installed on its supported PHP versions, then the module is built (DI compile + static-content deploy). Cells show passed / failed / untested; staircase gaps render as `–`.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | Pass | Pass | – | – |
| 2.4.8 | – | Pass | Pass | – |
| 2.4.9 | – | – | Pass | not tested |


### Code Quality

Advisory checks against the module's source. Never affect the Compatibility verdict — a phpcs finding can't make a module incompatible.

#### Static Analysis

Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| PHPCS | Warning | 4 | 4 warnings (ruleset: Magento2) — 2 auto-fixable with phpcbf |
| PHPMD | Pass | 0 |  |
| Cpd | Pass | 0 |  |
| Composer validate | Pass | 0 |  |

#### PHPStan

Type-checks the module against a real Magento install. Re-runs per Magento + PHP version because resolvable symbols differ between releases.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | 1 | 1 | – | – |
| 2.4.8 | – | 1 | 1 | – |
| 2.4.9 | – | – | 1 | N/A |


### Tests

Unit and integration suites run per Magento + PHP cell. Test failures speak to the module's behaviour, not its compatibility with a line, so they're reported here separately.

#### Unit Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | – | – |
| 2.4.8 | – | N/A | N/A | – |
| 2.4.9 | – | – | N/A | N/A |

#### Integration Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | – | – |
| 2.4.8 | – | N/A | N/A | – |
| 2.4.9 | – | – | N/A | N/A |


### Security

Dependency-advisory audit (composer audit) plus a source malware scan. A malware detection fails the version outright.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| Composer audit | Pass | 0 |  |
| Malware scan | Pass | 0 |  |

## Licence and pricing

Free. A licence is still minted on checkout and bound to your project for Composer access — no payment step.

Refundable within 14 days of first purchase via https://packagento.com/account/refunds/.

## Install via Claude Code or any MCP client

The Packagento MCP server can run the licence + project + Composer steps above in one tool call:

```
purchase_and_install_packages(
  composer_names=["elgentos/magento2-oh-dear-checks"],
  project_id="proj_xxx"
)
```

This handles cart, checkout, licence minting, project activation, and writes auth.json credentials. Connect a client with `claude mcp add packagento https://mcp.packagento.com`. Full setup at https://packagento.com/docs/mcp-setup.

## Vendor

elgentos is a Magento 2 vendor on Packagento. See https://packagento.com/elgentos.md for their full catalogue.

