Skip to content

v0.3.1

Choose a tag to compare

@github-actions github-actions released this 28 Nov 22:28
· 23 commits to dev since this release

Changes since the initial commit.

procmon 0.3.1 monitors system calls made by processes inside LXC containers for audit purposes and writes the totals to SQLite. The package is x86-64 and expects cgroup v2.

Collector:

  • An eBPF program attaches to the raw syscall tracepoint. A task is counted when a cgroup v2 ancestor is a directory named lxc.payload.<name>. The innermost match wins, so nested LXC is attributed to the inner container. Docker containers and lxc.monitor.* are omitted.
  • Aggregates stay in a per-CPU kernel map keyed by container cgroup, process comm, and syscall number. Each flush writes that window to SQLite. calls counts entries, errors counts returns in [-4095, -1], and total_ns is the time spent in the call.
  • Configuration is TOML, /etc/procmon/procmon.toml by default. retain of 0 keeps every row. A duration such as 168h deletes older samples. The installed file sets 0. When the key is omitted, the default is 168h.
  • The systemd unit runs as root with CAP_BPF, CAP_PERFMON, CAP_SYS_ADMIN, and CAP_SYS_RESOURCE. CAP_SYS_ADMIN is what lets tracepoint attach succeed on Debian kernels.
  • SIGINT and SIGTERM flush the current window and exit. SIGHUP rereads the TOML file and applies it. If the file cannot be read or the configuration is invalid, the running configuration is left unchanged. After a successful reload, payload cgroups are rescanned and the current window is flushed.
  • vacuum_interval rewrites the database on that interval and returns pages freed by retention to the OS. 0 disables it. The default is 0.
  • vacuum_on_start rewrites the database once, after it is opened and before cgroup discovery or tracepoint attach. A failure stops the process. The default is false. A reload does not vacuum again.

API:

  • procmon-api reads the metrics database and serves it over HTTP on a unix socket, /run/procmon/api.sock by default. It does not terminate TLS. procmon.target starts the collector and the API. tmpfiles creates /run/procmon for the socket.
  • The process is its own OAuth authorization server. The grant is client_credentials, and tokens are RS256 JWTs. Client ids and Argon2i secret hashes live in a separate SQLite database. client add prints the secret once.
  • base_url is the public https URL, including an optional path prefix. With https://procmon.example/procmon, data routes are under /procmon/v1/ and the discovery document is GET /.well-known/oauth-authorization-server/procmon.
  • Authenticated routes are GET /v1/syscall-stats, GET /v1/flushes, and GET /v1/syscalls. The syscall route returns the assigned x86-64 syscall numbers and names. GET /openapi.json, the JWKS document, and token request are unauthenticated. since and until are RFC3339 timestamps or a Go duration such as 1h.
  • SIGHUP rereads the API configuration. A read or validation error leaves the running configuration unchanged. SIGINT and SIGTERM close the socket and exit. systemctl reload procmon-api sends SIGHUP.

Build and release:

  • make build generates the eBPF object, builds both binaries, and writes dist/procmon_<version>-1_amd64.deb.
  • The package version can be injected at build time. A branch push builds a dev package whose version is <version>-dev.g plus the 12-character git hash, so it sorts before the release package of the same version.
  • A tag push runs the unit tests and, after they pass, attaches the release package here.
  • eBPF generation on Debian and Ubuntu installs llvm for llvm-strip and passes the multiarch include directory so asm/types.h is found.