Mercurial > prosody-modules
annotate mod_http_health/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 | 9bcd257dea4e |
children | 09233b625cb9 |
rev | line source |
---|---|
5667
9bcd257dea4e
mod_http_health: Provide a health check HTTP endpoint
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
1 Simple module adding an endpoint meant to be used for health checks. |
9bcd257dea4e
mod_http_health: Provide a health check HTTP endpoint
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
2 |
9bcd257dea4e
mod_http_health: Provide a health check HTTP endpoint
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
3 # Configuration |
9bcd257dea4e
mod_http_health: Provide a health check HTTP endpoint
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
4 |
9bcd257dea4e
mod_http_health: Provide a health check HTTP endpoint
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
5 After installing, enable by adding to [`modules_enabled`][doc:modules_enabled] like many other modules: |
9bcd257dea4e
mod_http_health: Provide a health check HTTP endpoint
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
6 |
9bcd257dea4e
mod_http_health: Provide a health check HTTP endpoint
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
7 ``` lua |
9bcd257dea4e
mod_http_health: Provide a health check HTTP endpoint
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
8 -- in the global section |
9bcd257dea4e
mod_http_health: Provide a health check HTTP endpoint
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
9 modules_enabled = { |
9bcd257dea4e
mod_http_health: Provide a health check HTTP endpoint
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
10 -- Other globally enabled modules here... |
9bcd257dea4e
mod_http_health: Provide a health check HTTP endpoint
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
11 "http_health"; -- add |
9bcd257dea4e
mod_http_health: Provide a health check HTTP endpoint
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
12 } |
9bcd257dea4e
mod_http_health: Provide a health check HTTP endpoint
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
13 ``` |
9bcd257dea4e
mod_http_health: Provide a health check HTTP endpoint
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
14 |
9bcd257dea4e
mod_http_health: Provide a health check HTTP endpoint
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
15 # Details |
9bcd257dea4e
mod_http_health: Provide a health check HTTP endpoint
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
16 |
9bcd257dea4e
mod_http_health: Provide a health check HTTP endpoint
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
17 Adds a `http://your.prosody.example:5280/health` endpoint that returns either HTTP status code 200 when all appears to be good or 500 when any module |
9bcd257dea4e
mod_http_health: Provide a health check HTTP endpoint
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
18 [status][doc:developers:moduleapi#logging-and-status] has been set to `error`. |
9bcd257dea4e
mod_http_health: Provide a health check HTTP endpoint
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
19 |
9bcd257dea4e
mod_http_health: Provide a health check HTTP endpoint
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
20 # See also |
9bcd257dea4e
mod_http_health: Provide a health check HTTP endpoint
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
21 |
9bcd257dea4e
mod_http_health: Provide a health check HTTP endpoint
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
22 - [mod_measure_modules] provides module statues via OpenMetrics |
9bcd257dea4e
mod_http_health: Provide a health check HTTP endpoint
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
23 - [mod_http_status] provides all module status details as JSON via HTTP |