Adding a check type
Add a new kind of monitor.
A check type is a config struct and a function in crates/checks, plus a form
in the frontend. The server and database need no changes.
-
Write the check. Add a module in
crates/checks/src/with a config struct (Serialize,Deserialize), avalidate()method, and anasync fn check(...) -> CheckOutcome. Look attcp.rsfor a small example. -
Register it in
crates/checks/src/lib.rs:- add the module and re-export it;
- add a variant to
CheckConfig. Its kebab-case name becomes thetypevalue in JSON; - add arms to
validateandcheck; - if the config holds secrets, handle them in
redactandkeep_secrets_from; - if the service reports in rather than being checked, update
is_passive.
-
Check the target. The dashboard shows a service's target from the config's
url,hostorcontainerfield. If yours uses another key, add a migration that updates the generatedtargetcolumn. -
Add the form. In
frontend/src/routes/(dashboard)/services/new/+page.svelte, add the type toserviceTypes, its fields to the form, and its config tobuildConfig(). Checkservices/[id]/+page.svelteshows it correctly. -
Test and document it. Add unit tests next to the check, and a page in
landing/content/docs/monitors/, linked from the check types table.