Metrics¶
All metrics are gauges, except moodle_folder_downloads_total (counter). Session counts are cached for one minute; disk usage comes from the hourly scheduled task.
Metric |
Labels |
Description |
|---|---|---|
|
|
Moodle version (always 1). |
|
1 when the site is in maintenance mode. |
|
|
Unix time of the last cron start (0 if unknown). |
|
|
|
Users whose last access is within the window. |
|
Users that are not deleted (suspended included). |
|
|
Open sessions in the session handler. |
|
|
Open sessions of logged in users (guests excluded). |
|
|
Adhoc tasks waiting to run. |
|
|
Waiting adhoc tasks whose next run time has passed. |
|
|
Adhoc tasks marked as running. |
|
|
Adhoc tasks with a fail delay. |
|
|
Age of the oldest waiting adhoc task. |
|
|
|
Adhoc task runs in the window (1 hour by default), from the task log; the 10 classes with the longest total duration. |
|
|
Failed adhoc task runs in the window, same classes. |
|
|
Total ( |
|
|
Adhoc tasks waiting to run now; the 10 classes with the longest queue, the rest in |
|
|
Age of the oldest adhoc task waiting to run, same classes. |
|
Enabled scheduled tasks with a fail delay. |
|
|
Quiz attempts in progress (previews excluded). |
|
|
|
1 when the cache store instance is ready. |
|
|
Size of each top level folder of moodledata ( |
|
Unix time of the last disk scan. |
|
|
Duration of the last disk scan. |
|
|
|
Folders ( |
|
Size of the largest folder. |
|
|
Folders above the download limit (50 MiB by default) with the “Download folder” button enabled. |
|
|
|
Counter of folder downloads (ZIP of every file), by size band and by the state of the button at download time. |
|
Unix time of the last count of the folders. |
|
|
|
Forum discussions by band of number of posts ( |
|
Posts of the largest discussion. |
|
|
Discussions above the large discussion limit (10000 posts by default). |
|
|
Unix time of the last count of the discussions. |
|
|
|
Large files by component ( |
|
Unix time of the last count of the large files. |
|
|
|
1 when the collector (or the hook) succeeded. |
|
|
Time spent by the collector. |
Cache hit ratio¶
Moodle keeps cache hit and miss statistics only inside the current request ($CFG->perfdebug), so a hit ratio per store cannot be exported across requests. The exporter reports the readiness of each store instead.
Folders¶
The “Download folder” button makes mod/folder/download_folder.php build the ZIP in PHP: with large folders, it holds a web server process for minutes. The compute_folder_sizes task counts the folders every hour (one aggregate query on files, never during a scrape). A folder equal to a band limit belongs to that band; the limits are configurable (Configuration).
The names and labels are the same as the external moodle_ops_exporter, so that the same dashboards and alerts work with both.
The ZIP is also built when someone opens the download URL directly, even with the button disabled: the core only checks mod/folder:view. moodle_folder_downloads_total shows it (download_enabled="0"); it is counted by an observer of \mod_folder\event\all_files_downloaded, without reading the log. Block the URL of large folders in the web server if needed.
The external moodle_ops_exporter publishes moodle_folder_downloads, the count in a window read from the log; increase(moodle_folder_downloads_total[1h]) gives the same value for one hour.
Adhoc tasks by class¶
One class can hold the adhoc queue for a long time (for example the recalculation of quiz statistics in a quiz with thousands of attempts) without the totals showing which one. The task log metrics read task_log (adhoc runs, timestart in the window), with the same names and selection as the external moodle_ops_exporter; the queue metrics read task_adhoc and exist only here. Class names have no leading backslash, as in the task log. The values are kept for one minute.
The task log is written only when the task logs are kept (Site administration > Server > Tasks > Task log configuration).
Forums¶
Discussions with tens of thousands of posts take too long to open and nothing else shows them. The compute_forum_sizes task counts the posts of each discussion every hour (deleted posts excluded; one aggregate query on forum_posts, never during a scrape). A discussion equal to a band limit belongs to that band; the limits are configurable. The names and labels are the same as the external moodle_ops_exporter.
Large files¶
Very large files (PDFs of hundreds of MB in pages and resources) hurt downloads and backups. The compute_large_files task counts them every hour, reading only files above the first band limit (filesize has no index: on very large sites, run the task less often in Scheduled tasks). This metric exists only in tool_prometheus.