Examples
banshee/examples-collection/examples/mechanics/
selection-only
Example: per with only, a default selection of named elements; systemd services by SSH.
par banshee1 installation2 versions
v2Dernière
Publiée le 28 octobre 2026. One naming convention across collections; documentation completed.
Selection: per and only
'only' => array('ssh', 'sshd', 'cron', 'crond') makes the default selection "only these elements": of all the systemd services of a Linux, the SSH server and cron are watched by default, under the names Debian (ssh, cron) and Fedora (sshd, crond) give them.
How to read it
- The collector still returns every service it sees: the poller keeps only those the selection names. The administrator adds others on the probe, by name or by pattern (
nginx*). ignoreandonlynever go together.text.match($line, '([^ ]+).service +[^ ]+ +([^ ]+)'): the name of the service in the first group, its active state in the second. A line that does not match is skipped.watch.expectraises on any state butactive.- A refused
systemctl(a machine without systemd, such as Alpine) or an answer with no service stops the collectormisconfigured: an empty answer would leave the probe green with nothing judged.
To adapt it
- A selection that finds nothing raises nothing: a name the machine does not use (
sshdon Debian,cronon Fedora) is not a service that stopped, it is a service nobody watches, and the probe stays green. Write inonlythe names each distribution gives the service, as here, and check on a first run that the probe shows the services you meant. - To raise when a named service is not there at all, add
watch.missingwith its names; only a name every machine of the probe uses belongs in it.