package stramon-lib

  1. Overview
  2. Docs

Module Stramon_libSource

Process behavior monitoring library based on strace

Stramon-lib is primarily designed to power Stramon, or to be used in similar fashion of process monitoring.

Absolute path

Sourcemodule Abs_path : sig ... end

Normalized absolute path representation

Path trie

Sourcemodule Path_trie : sig ... end

Path trie based path set

Sourcemodule Path_trie_set : sig ... end

Main monitoring facilities

Sourcemodule Syscall : sig ... end

Syscall data and handler

Sourcemodule Stats : sig ... end

Basic monitoring statistics

Sourcemodule Monitor_result : sig ... end

Result of a monitoring session

Sourcetype debug_level = [
  1. | `None
  2. | `Registered
]
Sourceval monitor : ?debug_level:debug_level -> ?stdin:Unix.file_descr -> ?stdout:Unix.file_descr -> ?stderr:Unix.file_descr -> handlers:'a Syscall.handler list -> init_ctx:'a -> string list -> ('a Monitor_result.t, string) result

monitor ~handlers ~init_ctx cmd spawns a monitoring session of cmd.

debug_level determines the debuging information printed to stderr:

  • `None: print nothing (default)
  • `Registered: print data recognized by one of the handlers

stdin, stdout, stderr are passed to Unix.create_process, default to Unix.stdin, Unix.stdout, and Unix.stderr respectively.

init_ctx defines the initial "context". It will be provided to the first handler to be invoked.

If any of the handlers raises an exception, then monitoring is interrupted, and exception is captured in the returned monitor result.

Returns Error if monitor fails to create process with cmd wrapped with strace. This normally means the strace program is not available.

Misc utilities

Sourcemodule Utils : sig ... end