Configuration¶
The settings are in Site administration > Plugins > Admin tools > Prometheus exporter.
Token¶
Prometheus sends the token in the Authorization: Bearer <token> header. Use a long random value (for example openssl rand -hex 32). The token is never accepted in the query string, which ends up in access logs.
Without a token the endpoint answers
503(not configured).Missing or wrong token:
401.
To keep the token out of the database, force it in config.php (for example from an environment variable):
$CFG->forced_plugin_settings['tool_prometheus']['token'] = getenv('MOODLE_PROMETHEUS_TOKEN');
Allowed IP addresses¶
Optional. One address or range per line (CIDR, or partial addresses such as 10.1.). Requests from other addresses get 403, even with a valid token. Behind a reverse proxy, configure Moodle ($CFG->reverseproxy and $CFG->getremoteaddrconf) so it sees the real client address.
Active user windows¶
Comma separated windows, in seconds, of the moodle_users_active gauge (one window label each, at most ten). Default: 300,3600,86400.
Scheduled task¶
Compute moodledata disk usage for the Prometheus exporter runs every hour (minute 23). It only reads moodledata and stores the sizes in the plugin configuration; the endpoint reports the last result.
Host name used by Prometheus¶
Moodle redirects requests whose host differs from $CFG->wwwroot. Prometheus must reach the endpoint with the host of wwwroot:
scrape the public URL of the site; or
scrape an internal address through
proxy_url(the target keeps thewwwroothost while the connection goes to the internal address), as in the example in Usage.
Folders¶
Folder size bands (
folderbands, default25,50,100): Limits, in MiB, of the size bands ofmoodle_folders.Folder download limit (
folderdownloadlimit, default50): Size, in MiB, above which a folder with the download button enabled is counted inmoodle_folders_large_download_enabled.
Adhoc tasks¶
Adhoc task log window (
adhocclasswindow, default3600): seconds of the task log read by the adhoc metrics by class.
Forums¶
Forum discussion bands (
forumbands, default1000,5000,10000): limits, in posts, of the bands ofmoodle_forum_discussions.Large discussion limit (
forumlargelimit, default10000): posts above which a discussion is counted inmoodle_forum_discussions_large.
Large files¶
Large file bands (
largefilebands, default50,100): limits, in MiB, of the bands ofmoodle_files_large; the first one is the floor.Large file components (
largefilecomponents, defaultmod_page,mod_resource,mod_folder): components whose files are counted.