Magento health check report showing cron, indexer and cache status

A Magento health check is a short list of things to look at before a customer finds the problem for you. Most store failures are quiet. Cron stops and order emails stop with it. An indexer goes invalid and products drop out of category pages. Someone switches off the full page cache while debugging and forgets to switch it back on. Nothing crashes, so nobody notices until sales dip or a customer writes in.

Below are the 14 checks our team runs when we pick up a Magento 2 store, with the commands and SQL to run each one by hand. At the end we cover a free module we wrote that runs all 14 for you, in the admin or from bin/magento.

Why a Magento health check matters more than an uptime monitor

An uptime monitor tells you the home page loads. It can’t tell you that the last cron job ran two days ago, that the catalog search index needs a rebuild, or that var/log/system.log is 9 GB and the disk is close to full. A store can return a 200 response all day while checkout emails, price rules and sitemaps have stopped working behind it.

Run the commands below from the Magento root, as the user that owns the files. For the SQL, use a MySQL client connected to the store database. Magento stores cron and admin dates in UTC, so the queries use UTC_TIMESTAMP() instead of NOW().

Cron: the first thing to check

Almost everything that happens in the background in Magento runs through cron: queued emails, indexing on schedule, catalog price rules, currency rates, sitemaps and cleanup jobs. When it stops, the store keeps loading, which is why it often goes unnoticed for days.

When did cron last run?

SELECT MAX(executed_at) FROM cron_schedule;

Magento’s cron runs every minute, so this should be a few minutes old at most. If it’s hours old or empty, run crontab -l as the web server user. If the Magento lines are missing, bin/magento cron:install adds them. Running bin/magento cron:run once by hand shows any error straight away. Adobe’s guide to configuring cron jobs covers the setup in detail.

Jobs stuck in running

SELECT job_code, executed_at FROM cron_schedule WHERE status = 'running' AND executed_at < UTC_TIMESTAMP() - INTERVAL 1 HOUR;

A row that has said “running” for hours usually means the PHP process died, often from a memory limit or a server restart. Check ps aux | grep cron to see whether anything is still working, and read var/log/cron.log.

Jobs that failed in the last day

SELECT job_code, COUNT(*) FROM cron_schedule WHERE status = 'error' AND scheduled_at >= UTC_TIMESTAMP() - INTERVAL 1 DAY GROUP BY job_code;

The messages column holds the error text for each failed run. One job failing every few minutes is usually a broken third-party module or a missing API credential.

Indexers, cache and deploy mode

  • Indexers. bin/magento indexer:status lists every indexer. Any line that says “Reindex required” needs bin/magento indexer:reindex <indexer_id>. If the same ones keep going invalid, set them to “Update by Schedule” and check that cron runs. Adobe’s page on managing indexers lists the commands.
  • Cache types. bin/magento cache:status shows each cache type with 1 (on) or 0 (off). On a live store every line should be 1. A disabled full_page cache makes every page view hit PHP and the database.
  • Deploy mode. bin/magento deploy:mode:show should say production on a live store. Developer mode is slower and can show error details to visitors.

If speed is the worry, our Magento speed checklist goes further than cache and mode.

Admin security basics

  • Admin URL. bin/magento info:adminuri prints the admin path. If it’s /admin, bots find the login page on the first try. Change it with bin/magento setup:config:set --backend-frontname=<new_path>.
  • Two-factor authentication. bin/magento module:status Magento_TwoFactorAuth should say the module is enabled. Developers sometimes disable it on staging and the setting travels to live with the next deploy.
  • Unused admin accounts. SELECT username, logdate FROM admin_user WHERE is_active = 1 AND (logdate < UTC_TIMESTAMP() - INTERVAL 90 DAY OR logdate IS NULL); lists active accounts nobody has used in 90 days. Old agency and freelancer logins are an easy way in if a password leaks. Deactivate them in System > Permissions > All Users.

These checks are basic hygiene, not a security review. Our post on what happened to stores that didn’t patch SessionReaper in time shows why missing patches matter more than any single setting.

Versions, disk and database

  • Magento version. bin/magento --version prints it. Compare it with the latest patch for your release line on Adobe’s released versions page. If you’re planning a move to 2.4.9, read what breaks in a 2.4.9 upgrade first.
  • PHP version. php -v shows the CLI version only. The web server often runs a different PHP build, so check that one too, for example from your hosting panel.
  • Log files. ls -lhS var/log | head lists the largest logs first. A log that grows by gigabytes usually points to one repeated error. Fix the cause, then rotate the file.
  • Search engine. Magento 2.4 needs OpenSearch or Elasticsearch to show category and search results. In the admin, open Stores > Configuration > Catalog > Catalog > Catalog Search and click “Test Connection”.

Some tables grow without limit unless cleanup is configured. This query shows their size:

SELECT TABLE_NAME, TABLE_ROWS, ROUND((DATA_LENGTH + INDEX_LENGTH) / 1048576) AS mb FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME IN ('customer_visitor', 'report_event', 'report_viewed_product_index', 'cron_schedule', 'quote', 'magento_bulk', 'magento_operation');

TABLE_ROWS is an InnoDB estimate, which is fine for spotting a table with tens of millions of rows. The cleanup settings live under Stores > Configuration, in Customers > Customer Configuration > Online Customers Options, Advanced > System > Cron, and Sales > Checkout > Shopping Cart. Take a backup before deleting rows by hand.

Run all 14 checks with our free module

Running 14 checks by hand every week is the kind of job that gets skipped. So we wrote Magento 2 Store Health Check, a free module that runs all of the checks above and reports OK, WARN or FAIL for each one, with a short note on how to fix it.

CheckFlags it when
Cron last runWARN over 15 minutes, FAIL over 60 minutes or never run
Cron jobs stuckJobs in “running” for more than 1 hour
Cron errorsJobs ended with “error” in the last 24 hours
IndexersFAIL when any indexer needs a reindex
Cache typesAny cache type is disabled
Deploy modeDeveloper mode
Admin URL pathPath is “admin”
Admin 2FAMagento_TwoFactorAuth disabled or missing
Magento versionRelease line older than 2.4.6
PHP versionBelow PHP 8.1
Large tablesOver 1,000,000 rows or 1,024 MB (configurable)
Log filesA file in var/log over 500 MB (configurable)
Unused admin accountsNo login in 90 days
Search engineFAIL when it doesn’t answer a ping

You see the report in the admin under System > Tools > Store Health Check. On the command line, bin/magento mconnect:health prints a table and bin/magento mconnect:health --format=json prints JSON. The command exits with 1 when any check fails, so you can call it from your own monitoring or a cron script and get alerted.

It’s free and MIT licensed. Get it from GitHub or from its page on our site. To install with Composer:

  • composer config repositories.magento2-store-health-check vcs https://github.com/mcsventures/magento2-store-health-check
  • composer require mconnect/module-store-health-check:^1.0
  • bin/magento module:enable Mconnect_StoreHealthCheck
  • bin/magento setup:upgrade
  • bin/magento setup:di:compile (production mode only)
  • bin/magento cache:flush

It reports, it doesn’t repair

  • It changes nothing. It doesn’t reindex, clear caches, delete rows or rotate logs. It tells you where to look.
  • It doesn’t know the latest Magento patch number. We left out a built-in version list because it would go out of date. It links to Adobe’s release page instead.
  • The PHP version it reports is the one running the check. Run it from the admin and the CLI to see both.
  • It isn’t a security scan. It doesn’t look for malware, changed core files or missing patches.
  • It sends no data to any outside server.

When a WARN needs more than a quick fix

Most WARN lines take a few minutes to fix. Some don’t: cron that dies every night, indexers that never stay valid, a quote table with tens of millions of rows, a store that needs a release line upgrade. Those are the jobs our team does every week.

When the cause turns out to be a custom module, our Magento module development team can fix it or write a replacement.

Want us to fix what the report finds? Our Magento support plans start at $599 a month. For a slow store, see our Magento speed optimization service, and for patches and break-in checks, our Magento security audit. Starting prices in USD, final quote after a short call. Contact us.

The source code, issue tracker and full README are on the module’s GitHub page. The download and changelog are on the Magento 2 Store Health Check product page.

Sources

More free extensions from our team

    Need Magento expert help?

    We provide result-driven solutions to expand the competency level and productivity.

    Instant Help CenterAvailable!

    Monday to FridayResponse promised within 24 hours!

    Magento payment transaction failed email caused by a fake PayPal Payflow response

    Load Comments

    Your email address will not be published. Required fields are marked *

    5 4 3 2 1