banshee/linux-collection/linux/ssh/
services
State of the services of a Linux by SSH, under systemd or OpenRC.
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 collectormisconfigured, where version 2 returned nothing and stayed green. - The default selection adds
ssh(the SSH server on Debian) andcrond(cron on Fedora and Alpine) tosshdandcron. - A line the collector does not recognise is skipped, and a service listed twice is returned once; version 2 stopped on either.
missingis new: a watched service that disappears raises once its name is set.stoppedkeeps 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:
startedis given asactive,stoppedasinactive,crashedasfailed; 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
| Output | Per | Meaning |
|---|---|---|
manager | — | systemd or openrc |
state | service (its name, without .service) | the state |
Watches
| Watch | Kind | Defaults | Checked |
|---|---|---|---|
stopped Service stopped | expect, on state | critical unless active | yes |
missing Service missing | missing, on state | no expected name | yes, raises once names are set |
Limits
- Under OpenRC,
rc-status -alists 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.