Admin tools: Heartbeat check (eg Nagios / Icinga)

tool_heartbeat
Maintained by Picture of Catalyst IT Catalyst IT, Picture of Brendan Heywood Brendan Heywood
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.
167 sites
88 downloads
8 fans

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:

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

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:

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

Screenshots

Screenshot #0

Contributors

Picture of Catalyst IT
Catalyst IT (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Picture of David Mudrák
    Tue, 3 Mar 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!
  • Picture of Brendan Heywood
    Tue, 3 Mar 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
  • Picture of John Rickard
    Wed, 1 Apr 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?

    Thanks
    John Rickard
  • Picture of Eduardo Hm
    Mon, 9 May 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.
  • Picture of Brendan Heywood
    Tue, 10 May 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

    https://github.com/brendanheywood/moodle-tool_heartbeat#a-heartbeat-test-page-for-moodle
Please login to post comments