Heartbeat check (eg Nagios / Icinga)

Admin tools ::: tool_heartbeat
Maintained by Catalyst IT, Brendan Heywood, Daniel Thee Roperto
A load balancer heartbeat / health checker url, and also a configurable nagios compliant cron health checker. This should work out of the box with most load balancers, eg Amazon ELB, F5, HA proxy etc as most of these simply check the http status for 200 or non-200 response codes.
Latest release:
651 sites
14 fans
Current versions available: 1

A heartbeat test page for Moodle

Very simple, just performs a quick check of all critical service dependancies (filesystem, DB, caches, and sessions) and return OK

Use from a load balancer to tell whether a node is OK

Just install the plugin normally and then point your load balance to a url like this:


It will return a page with either a 200 or 503 response code and if it fails a string for why.

By default it only performs a light check, in particular it does not check the moodle database. To do a full check add this query param:


This check can also be run as a CLI:

php index.php fullcheck

A nagios cron health checker

A script croncheck is a nagios compliant checker to see if cron or any individual tasks are failing, with configurable thresholds

This script can be either run from the web:


Or can be run as a CLI in which case it will return in the format expected by Nagios:

sudo -u www-data php /var/www/moodle/admin/tool/heartbeat/croncheck.php

The various thresholds can be configured with query params or cli args see this for details:

php croncheck.php -h


Screenshot #0


Catalyst IT (Lead maintainer)
Daniel Thee Roperto: Developer
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Tue, Mar 3, 2015, 3:58 AM
    Thanks Brendan for sharing this plugin. It is apparently focused on sites with quite specific setup. I found it working as expected. The only suggestion I have was reported to your issues tracker. With the hope that will be fixed soon (I can imagine info in the README and in the plugin description here), I am going to approve this now. You are cleared to land, welcome to the Plugins directory!
  • Tue, Mar 3, 2015, 8:51 AM
    hi David, re #1 that is now automated in code with no config needed, I'll add a new version here. Thanks smile
  • Wed, Apr 1, 2015, 4:55 PM
    Hi There

    This looks a brilliant tool - I have been wanting to have some sort of error tracking on the cron for a while!

    Can you tell me how to integrate it into Nagios?

    John Rickard
  • Mon, May 9, 2016, 8:07 PM
    Good morning Brendan

    I just discovered this simple tool to check the status of any Moodle platform. I was interested enough because in our organization, we manage several platforms Moodle and our Nagios is difficult to check whether the site is ok or not, if the database connected or not connected.

    I tested it in a test environment and the truth is quite functional and very useful. What interest me is how to include the two checks (the fullcheck and croncheck) in the Nagios service we have assembled in our company.

    Anyway thank you very much.
  • Tue, May 10, 2016, 8:16 AM
    If you are not familiar with configuring nagios using the cli plugins, it might be easier to configure nagios to test whether any arbitrary url is working and then point it at the heartbeat url which returns a 200 or a 503

  • Wed, Nov 15, 2017, 10:44 PM
    Context : Moodle 3.2/LAMP
    This plugin seems to use the 'memcache' PHP module, not the 'memcached' one, to check Memcached session server (if apply). Correct?

    Thanks for you great job!
    Best regards.
  • Wed, Nov 15, 2017, 10:58 PM
    and the 'tool_heartbeat | testing' setting is only applied for the 'croncheck' script, right?

    Best regards,
  • Thu, Nov 16, 2017, 10:47 AM
    hi Benoît,

    Yes the testing mode is only for the croncheck, and yes the session check is hard coded and quite hacky (we don't actually use that particular feature very much, it's monitored in other ways). It would be much better if it detected which session handler was being used and each session handler declared it's own concept of healthy which is the intention of this tracker which ideally will make this plugin redundant:

  • Mon, Sep 2, 2019, 7:14 PM
    It would be nice to have official support for MDL 3.5 (and up) smile
    How about caching checks? Redis support needed.
Please login to post comments