banshee is under active development: collectors will keep changing, and a version you publish will likely need adjustments. For stable use, wait for version 1.0.0.

Linux

banshee/linux-collection/linux/ssh/

services

State of the services of a Linux by SSH, under systemd or OpenRC.

  • linux
  • ssh
  • systemd
  • openrc
  • service
  • alpine
  • debian
  • fedora

by banshee1 installation2 versions

Services of a Linux, by SSH

Returns the service manager that answered, systemd or OpenRC, and the state of each service, in systemd's words. By default only the SSH server and cron are watched; the others are chosen on the probe.

What changed since version 2

  • OpenRC (Alpine) is supported beside systemd (Debian, Fedora); the manager that answered is returned in manager. A machine where neither answers stops the collector misconfigured, where version 2 returned nothing and stayed green.
  • The default selection adds ssh (the SSH server on Debian) and crond (cron on Fedora and Alpine) to sshd and cron.
  • A line the collector does not recognise is skipped, and a service listed twice is returned once; version 2 stopped on either.
  • missing is new: a watched service that disappears raises once its name is set.
  • stopped keeps its id, kind and defaults: a probe upgraded from version 2 keeps its settings.

How it works

The collector runs systemctl list-units --type=service --all --no-legend --plain. If systemd does not answer (the command is missing, or the machine did not boot with systemd), it runs rc-status -a. If neither answers, it stops misconfigured with both error messages.

  • systemd: the state is the active state (active, inactive, failed, activating…).
  • OpenRC: started is given as active, stopped as inactive, crashed as failed; other states stay as written. One watch thus holds on the three systems.
  • Portable: both commands only read, and their output is the same on every distribution that ships them. Nothing is written on the target.

Prerequisites

  • an SSH account for monitoring, without write rights; listing services needs no privilege;
  • the fingerprint of the server's host key, set in protocol:ssh:fingerprint (not needed when the Security settings trust the first SSH fingerprint presented).

Outputs

OutputPerMeaning
manager—systemd or openrc
stateservice (its name, without .service)the state

Watches

WatchKindDefaultsChecked
stopped Service stoppedexpect, on statecritical unless activeyes
missing Service missingmissing, on stateno expected nameyes, raises once names are set

Limits

  • Under OpenRC, rc-status -a lists the services of a runlevel and those started by hand: a service in no runlevel and never started is not listed.
  • A service that is not installed is not listed either: the selection names services from several systems, and only those present are judged.