Admin tools: Heartbeat check (eg Nagios / Icinga)

tool_heartbeat
Maintained by Picture of Catalyst ITCatalyst IT, Picture of Brendan HeywoodBrendan Heywood, Picture of Daniel Thee RopertoDaniel 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.

Heartbeat check (eg Nagios / Icinga) 2018012300

Release notes

moodle-tool_heartbeat.svg?branch=master

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:

http://moodle.example.com/admin/tool/heartbeat/

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:

http://moodle.example.com/admin/tool/heartbeat/?fullcheck

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:

https://tracker.moodle.org/browse/MDL-47271

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:

http://moodle.example.com/admin/tool/heartbeat/croncheck.php

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

Installation

Via the Moodle plugin directory:

https://moodle.org/plugins/view/tool_heartbeat

Moodle 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4

Version information

Version build number
2018012300
Version release name
2018012300
Maturity
Stable version
MD5 Sum
e2b7654efbb839ff3a9c519f260f4417
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
  • This is the latest release for Moodle 2.4
  • This is the latest release for Moodle 2.5
  • This is the latest release for Moodle 2.6
  • This is the latest release for Moodle 2.7
  • This is the latest release for Moodle 2.8
  • This is the latest release for Moodle 2.9
  • This is the latest release for Moodle 3.0
  • This is the latest release for Moodle 3.1
  • This is the latest release for Moodle 3.2
  • This is the latest release for Moodle 3.3
  • This is the latest release for Moodle 3.4

Version control information

Version control system (VCS)
GIT
VCS repository URL
VCS branch
master
VCS tag
2018012300

Default installation instructions for plugins of the type Admin tools

  1. Make sure you have all the required versions.
  2. Download and unpack the module.
  3. Place the folder (eg "mytool") in the "admin/tool" subdirectory.
  4. Visit http://yoursite.com/admin to finish the installation