diff --git a/ansible/files/prosody.cfg.lua b/ansible/files/prosody.cfg.lua index 3c33a2e..55f73bf 100644 --- a/ansible/files/prosody.cfg.lua +++ b/ansible/files/prosody.cfg.lua @@ -162,7 +162,17 @@ authentication = "internal_hashed" authorization = "internal" storage = "internal" statistics = "internal" -statistics_interval = 60 + +if ENV_SNIKKET_TWEAK_PROMETHEUS == "1" then + -- When using Prometheus, it is desirable to let the prometheus scraping + -- drive the sampling of metrics + statistics_interval = "manual" +else + -- When not using Prometheus, we need an interval so that the metrics can + -- be shown by the web portal. The HTTP admin API exposure does not force + -- a collection as it is only interested in very few specific metrics. + statistics_interval = 60 +end certificates = "certs" @@ -200,6 +210,12 @@ VirtualHost (DOMAIN) invites_register = "/register"; } + if ENV_SNIKKET_TWEAK_PROMETHEUS == "1" then + modules_enabled = { + "prometheus"; + } + end + welcome_message = [[Hi, welcome to Snikket on $host! Thanks for joining us.]] .."\n\n" ..[[For help and enquiries related to this service you may contact the admin via email: ]] diff --git a/ansible/tasks/prosody.yml b/ansible/tasks/prosody.yml index 429800c..c513441 100644 --- a/ansible/tasks/prosody.yml +++ b/ansible/tasks/prosody.yml @@ -117,6 +117,7 @@ - mod_muc_local_only - mod_http_host_status_check - mod_measure_process + - mod_prometheus - name: Enable wanted modules (snikket-modules) file: