annotate mod_measure_modules/README.md @ 5668:ecfd7aece33b

mod_measure_modules: Report module statuses via OpenMetrics Someone in the chat asked about a health check endpoint, which reminded me of mod_http_status, which provides access to module statuses with full details. After that, this idea came about, which seems natural. As noted in the README, it could be used to monitor that critical modules are in fact loaded correctly. As more modules use the status API, the more useful this module and mod_http_status becomes.
author Kim Alvefur <zash@zash.se>
date Fri, 06 Oct 2023 18:34:39 +0200
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5668
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
1 # Introduction
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
2
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
3 This module reports [module status priorities][doc:developers:moduleapi#logging-and-status] as metrics, which are a kind of persistent log messages
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
4 indicating whether the module is functioning properly.
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
5
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
6 This concept was introduced in [Prosody 0.12.0][doc:release:0.12.0#api] and is not used extensively yet, primarily for reporting failure to load
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
7 modules or e.g. [mod_component] not being connected to its external component yet.
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
8
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
9 Besides using this to report problems, this metric could also be used to count how many modules are loaded or monitor for when critical modules aren't
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
10 loaded at all.
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
11
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
12 # Configuration
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
13
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
14 After installing, enable by adding to [`modules_enabled`][doc:modules_enabled] like many other modules:
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
15
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
16 ``` lua
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
17 -- in the global section
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
18 modules_enabled = {
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
19 -- Other globally enabled modules here...
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
20 "http_openmetrics";
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
21 "measure_modules"; -- add
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
22 }
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
23 ```
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
24
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
25 # Example OpenMetrics
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
26
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
27 ``` openmetrics
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
28 # HELP prosody_module_status Prosody module status
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
29 # UNIT prosody_module_status
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
30 # TYPE prosody_module_status gauge
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
31 prosody_module_status{host="example.org",module="message"} 0
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
32 prosody_module_status{host="example.org",module="presence"} 0
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
33 prosody_module_status{host="groups.example.org",module="muc"} 0
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
34 ```
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
35
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
36 # Details
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
37
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
38 The priorities are reported as the following values:
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
39
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
40 0
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
41 : `core` - no problem, nothing to report
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
42
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
43 1
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
44 : `info` - no problem, but a module had something important to say
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
45
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
46 2
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
47 : `warn` - something is not right
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
48
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
49 3
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
50 : `error` - something has gone wrong
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
51
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
52 Status changes are generally also reported in Prosodys logs, so look there for details.
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
53
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
54 # See also
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
55
ecfd7aece33b mod_measure_modules: Report module statuses via OpenMetrics
Kim Alvefur <zash@zash.se>
parents:
diff changeset
56 - [mod_http_status] provides all module status details as JSON via HTTP