lemano summary
Says what changed on targets in a period, who changed it, and what needs attention, from what the store recorded. It connects to no server.
lemano summary [NAME...] [-l SELECTOR] [--since DURATION|baseline]
[-o text|json|yaml|prometheus] [--out FILE] [--detailed-exitcode]The flags and examples of the command are also on its generated page.
| Flag | Meaning |
|---|---|
NAME... | Summarise these targets. Without names, every target in the store. |
-l, --selector | Keep the targets whose declared and derived labels match, as target list does. Not with names. |
--since | The period: a Go duration ending now (default 24h; 48h, 168h), or baseline. |
-o, --output | text (default), json, yaml or prometheus. |
--out FILE | Write to FILE instead of standard output, atomically (below). |
--detailed-exitcode | Exit 8 when at least one target needs attention. |
The period
A generation belongs to the period when it was written after its start
and up to now. A target’s changes are counted from the latest generation
written at or before the start (from) to its latest generation (to).
A target whose first generation was written in the period is a first
discovery, counted from generation 0.
Since the baseline
With --since baseline, each target’s changes are counted from its
baseline (lemano baseline) to its latest generation, and the target has
changed when its latest generation differs from the baseline. Its actions
are the diff from the baseline, lemano baseline NAME to accept the
changes, and lemano revert NAME --to N to go back. A target with no
baseline has the state noBaseline, and lemano baseline NAME as its
action.
States
Each target has one state, the first that applies:
| State | When |
|---|---|
attention | The target has an open condition: HostKeyChanged, IdentityChanged or UnfinishedTrial. |
notRead | The target was not seen as expected: see notRead below. |
noBaseline | Only with --since baseline: the target has no baseline. |
changed | Generations were written in the period (since the baseline: the latest generation differs from it). |
unchanged | None of the above. |
A target needs attention when its state is attention, notRead or
changed. A target without a baseline does not: the text names it on one
line, no baseline: a, b (lemano baseline NAME), and --detailed-exitcode
does not exit 8 for it.
Text
The first line counts the targets by state. One block follows for each
target that needs attention, in the order of the table above; unchanged
targets are only counted. A block lists the target’s conditions, why it
was not read, its changes grouped as in groups (about ten lines, then
and N more with the diff command), its reverts and trials, the facts
that changed, its notes (note:), and ends with its actions, one
next: line each. The notes of targets without a block follow under
notes:. A note needs no action now and does not change the state: a
full package check that never ran, or ran more than two of its
packageCheckInterval ago (the passes around a recorded run never run
it).
JSON and YAML
-o json and -o yaml give the same document. Fields marked “omitted”
are left out when empty or not set.
| Field | Meaning |
|---|---|
formatVersion | "1.0". The minor number grows when fields are added; the major number changes when a field is removed or changes meaning. |
since | Start of the period (RFC 3339, UTC); omitted with --since baseline. |
until | End of the period: when the summary was made. |
baseline | true with --since baseline; omitted otherwise. |
headline | The first line of the text. |
counts | targets, attention, notRead, noBaseline (omitted when 0), changed, unchanged. |
targets | One entry per target, by name, unchanged ones included. |
Each target:
| Field | Meaning |
|---|---|
name | The target’s name. |
state | One of the states above. |
conditions | Its open conditions, as target show shows them: type, status, reason, message, lastTransitionTime. Omitted. |
notRead | Why it was not seen as expected, one entry per reason: reason, since (when it started), passes (unreachable passes), kinds (kinds that failed). Omitted. |
baseline | The baseline’s generation, with --since baseline. Omitted. |
from, to | The generations changes are counted between. Omitted when the target has no generation. |
firstDiscovery | true when its first generation was written in the period. Omitted. |
generations | The generations written in the period, oldest first: seq, trigger (discover, revert, trial, run), createdAt, summary (as lemano history says it), and for a revert or a trial source, trial (id, outcome, expiresAt) and approval, and for a run run (tool, id, title, meta). Omitted. |
facts | Names of the facts that differ between from and to; their values are left out. Omitted. |
groups | The objects added, removed or changed between from and to, grouped, the largest group first. Omitted. |
kinds | Kinds read in one of the two generations and skipped or not supported in the other (kind, from, to); their objects are not in groups. Omitted. |
objectsChanged | Objects in groups. |
objectsChangedSinceBaseline | Objects of the latest generation not in sync with the baseline (changed, added or missing). Omitted without a baseline. |
lastCompletePass | When the latest pass that read the whole target (result changed or unchanged) started. Omitted when none did. |
overdue | true when its next pass is due and has not run, past a slack of half the interval (at most ten minutes) for a scheduler’s random delay. Omitted. |
kindsNotRead | Kinds the latest generation did not read: failed, skipped because they need root, or not supported. |
gapsNotRead | What the latest pass did not read, counted by reason, with accepted for the gaps the target file accepts (spec.discovery.acceptNotRead). Expected privilege gaps are not listed. Omitted when none. |
lastFullPackageCheck | When the package manager’s full check last ran whole. Omitted when it never did. |
firstPackageCheck | What the first full package check found, when it ran in the period: differ and missing, paths. The starting point, not changes: not in groups, never attention, and a period whose only generation is that check’s leaves the target unchanged. Omitted. |
notes | What is worth knowing without acting now, such as an old full package check or the gaps a pass accepted, apart from hostKernel gaps and files that hold credentials (credentials), which are only counted in gapsNotRead. Omitted. |
actions | The commands to look closer or act, each once. Omitted. |
notRead reasons:
| Reason | since |
|---|---|
overdue | When the next pass was due: one interval after the latest pass started. |
blindWindow | When the target was last seen; no pass succeeded for two intervals since. |
unreachable | When the run of unreachable passes that ends with the latest one started. |
partial | When the latest pass, which could not read everything, started. |
kindsFailed | When the latest pass, which could not read the kinds in kinds, started. |
Each group:
| Field | Meaning |
|---|---|
kind | The objects’ kind. |
change | added, removed or changed. |
count | Objects in the group. |
attribution | The cause the objects share, from the latest record that attributes each: confidence (package, evidence, unknown, lemano for a change a revert or a trial made, or run for a change found right after a run of another tool), source (apt, dpkg, dnf, dnf-rpm, sudo, auditd, revert, trial, or the tool of a run, such as ansible), user, program (the program alone, never its arguments), action (of a package operation: install, upgrade, remove and the like), generation (of the revert or trial, or the one read after the run), and for a run run (its title, else its ID) and note (what in the run changed the objects, such as the names of the tasks). |
objects | The first ten identities (Kind/identity), sorted. |
more | How many others. Omitted when none. |
A summary never holds a file’s content, a sealed value, a keyed hash or a command line.
Prometheus
-o prometheus writes gauges in the Prometheus text exposition format, with
HELP and TYPE lines and no timestamps, one sample per target, labelled
target:
| Metric | Value |
|---|---|
lemano_last_complete_pass_timestamp_seconds | lastCompletePass, in seconds since the Unix epoch. No sample when there is none. |
lemano_pass_overdue | 1 when overdue, else 0. |
lemano_objects_changed | objectsChanged: objects changed in the period. |
lemano_objects_changed_since_baseline | objectsChangedSinceBaseline. No sample without a baseline. |
lemano_kinds_not_read | kindsNotRead. |
lemano_condition | 1 per open condition, with the label condition (its type). |
Writing to a file
--out FILE writes the output to a hidden temporary file in the folder of
FILE, flushes it to disk, then renames it over FILE, so a reader sees the
old file or the new one, never part of one. The temporary name does not
end in the extension of FILE. A new FILE gets the mode a shell redirect
would give it, 0666 less the umask; an existing one keeps its mode.
Nothing is written to standard output.
Exit codes
0 when the summary was produced, with or without changes. With
--detailed-exitcode, 8 when at least one target needs attention. Errors
have their usual codes: 2 for a bad flag or period, 1 for a target that is
not in the store, 6 for a store that does not verify. See
exit codes.