ocaml-monitor#
Workload monitor for containers, unikernels, and VMs.
Overview#
This library provides an interface for monitoring and managing workloads across
different runtimes. Each backend implements the Monitor.S signature for
consistent lifecycle management.
Supported backends:
- Process: Native process execution (for dev/testing)
- Container: OCI containers via runc
- Unikernel: Solo5 unikernels (planned)
- Vm: QEMU/KVM virtual machines (planned)
Installation#
Install with opam:
$ opam install monitor
If opam cannot find the package, it may not yet be released in the public
opam-repository. Add the overlay repository, then install it:
$ opam repo add samoht https://tangled.org/gazagnaire.org/opam-overlay.git
$ opam update
$ opam install monitor
Usage#
open Monitor
let run env =
Eio.Switch.run @@ fun sw ->
(* Create a monitor *)
let mon = Process.create ~env () in
(* Configure and start a process *)
let config = Process_config.v "echo" [ "hello"; "world" ] in
match Process.start ~sw mon config with
| Ok handle ->
let status = Process.wait mon handle in
Format.printf "Process %a\n" pp_status status
| Error msg ->
Format.eprintf "Failed: %s\n" msg
Module Structure#
Monitor.S- Signature for monitor backendsMonitor.Process- Native process executionMonitor.Process_config- Configuration for native processes
Future modules:
Monitor.Container- OCI/runc containersMonitor.Unikernel- Solo5 unikernelsMonitor.Vm- QEMU/KVM virtual machines
Related Work#
-
OBuilder - Sandboxed build execution with snapshotting, by Thomas Leonard and the OCurrent team. OBuilder's sandbox abstraction inspired the
Monitor.Smodule type. -
Albatross - MirageOS unikernel orchestration, by Hannes Mehnert. Albatross provides patterns for unikernel lifecycle management.
Licence#
ISC License. See LICENSE.md.