Heartbeat check (eg Nagios / Icinga)
Heartbeat check (eg Nagios / Icinga) 2018012300
Code prechecksHTML | XML
A heartbeat test page for Moodle
A very simple plugin which 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
Example return values for heartbeat
Example for when the server is healthy.
(HTTP 200) Server is ALIVE sitedata OK
Example for when the server is in command line maintenace mode.
(HTTP 200) Server is in MAINTENANCE sitedata OK
Example for when the server is not healthy.
(HTTP 503) Server is DOWN Failed: database error
A nagios cron health checker
NOTE: Ideally this plugin should be redundant and most of it's functionality built into core as a new API, enabling each plugin to delare it's own extra health checks. See:
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
Via the Moodle plugin directory:
- Version build number
- Version release name
- Stable version
- MD5 Sum
- Supported software
- Moodle 2.4, Moodle 2.5, Moodle 2.6, Moodle 2.7, Moodle 2.8, Moodle 2.9, Moodle 3.0, Moodle 3.1, Moodle 3.2, Moodle 3.3, Moodle 3.4, Moodle 3.5, Moodle 3.6, Moodle 3.7, Moodle 3.8
- Latest release for Moodle 2.4
- Latest release for Moodle 2.5
- Latest release for Moodle 2.6
- Latest release for Moodle 2.7
- Latest release for Moodle 2.8
- Latest release for Moodle 2.9
- Latest release for Moodle 3.0
- Latest release for Moodle 3.1
- Latest release for Moodle 3.2
- Latest release for Moodle 3.3
- Latest release for Moodle 3.4
- Latest release for Moodle 3.5
- Latest release for Moodle 3.6
- Latest release for Moodle 3.7
- Latest release for Moodle 3.8
Version control information
- Version control system (VCS)
- VCS repository URL
- VCS branch
- VCS tag
Default installation instructions for plugins of the type Admin tools
- Make sure you have all the required versions.
- Download and unpack the module.
- Place the folder (eg "mytool") in the "admin/tool" subdirectory.
- Visit http://yoursite.com/admin to finish the installation