Table des matières
Moodle Load Monitor (tool_moodleload)
Administration tool that exposes, through a web service, the system metrics of the host running Moodle (CPU, memory, load average). It is designed to correlate, during a load test, the measured HTTP response times with the actual consumption of the server. It also provides the Moodle-side entry point of the MoodleLoad load testing platform, which lets you prepare and drive tests on a dedicated instance.
Guides
Feature summary
- Host metrics exposed through a web service: CPU usage (in %), total, available and used memory, load average over 1, 5 and 15 minutes.
- Function
tool_moodleload_get_metrics: accessible through REST, restricted to a dedicated token and to thetool/moodleload:readmetricscapability. - Dedicated web service “Moodle Load Monitor” (shortname
moodleload_monitor), to be assigned to a technical user. - Automatic provisioning: creation of a technical user
moodleloadand of a service token, valid for three months. - Administration dashboard (plugin home page) to view the state of the metrics and of the test engine.
- Status page under Site administration / Development: control of the test engine and of the injectors.
- MoodleLoad integration: settings for the front-end URL, the token, the timeout and HTTP authentication (basic, digest or automatic); authorisation of a test is subject to a signed handshake.
- Test security controls: global activation of load testing, maximum number of simultaneous sessions, allowed time windows.
- Measurement cache: configurable lifetime, so as not to query the system on every call.
- Test data preparation: creation of a “Load tests” course category, course restoration and bulk creation of setup users (with enrolment columns).
Exposed measurements
| Metric | Source | Remarks |
|---|---|---|
| CPU usage (%) | /proc/stat, delta between two snapshots | Value -1 on the first call: two calls spaced about 5 seconds apart are needed. |
| Total, available, used memory | /proc/meminfo | In bytes; -1 if unreadable. |
| Load average (1, 5, 15 min) | sys_getloadavg() | null on Windows. |
The host system must be Linux, with a readable /proc file system, for the CPU and memory measurements.
Web service call
GET /webservice/rest/server.php ?wstoken=<TOKEN> &wsfunction=tool_moodleload_get_metrics &moodlewsrestformat=json
The token must never appear in a shared URL or in a document. It must be generated for the technical user moodleload or for a dedicated user, and revoked if needed in Site administration / Server / Web services / Manage tokens.
Technical sheet
- Supported versions:
to 
| Technical sheet | |
|---|---|
| Component type | Administration tool (admin/tool) |
| Name | Moodle Load Monitor |
| Technical name | tool_moodleload |
| Supported versions | |
| Distribution | Moodle Marketplace |
| Availability | Alpha (MATURITY_ALPHA): for test use, not intended for production |
| GDPR compliance | Yes |
| Dependencies | No plugin dependency. Web services and REST protocol enabled. PHP 8.1 or higher. |
Builds
Note: a “Failing” status does not necessarily mean that the plugin does not work. This status reflects the result of automated tests checking the code against Moodle's strict standards. We are continuously working on bringing all supported plugins progressively into compliance with these development rules.
| Branch | Continuous integration tests |
|---|---|
| 405 |
|
| 501 |
|
Credits
Developed by Valery Frémaux (ActiveProLearn) for the MoodleLoad tool on the Moogwai platform.
