Skip to content

Linux processes over SSH (ssh_process) ​

Lists the processes of a Linux host over SSH and counts those whose program name, or whose command line, matches a pattern. It reports their summed CPU share and resident memory. By default no matching process is an error, so it watches that a daemon is running.

Channels ​

KeyNameUnitDefault limits
countMatching processesnoneerror below 1
cpu_pctCPU share%none
rss_bytesResident memoryBnone

cpu_pct is what ps reports: the share of one CPU over the life of each process, summed. It is not a current figure. To limit a count from above, set warn_max or error_max on the sensor. To allow zero, clear the default limit.

Parameters ​

ParameterDefaultMeaning
match_byrequiredname: the program name, compared exactly. It is the last part of the path the program was started from (/usr/sbin/sshd -D is sshd), without the colon some daemons add to their title and without the brackets of a kernel thread. command: a regular expression searched in the whole command line.
patternrequiredThe name, or the regular expression (Rust syntax). 1 to 300 characters.
port22TCP port of the SSH server.

Suggested interval: 60 seconds. Credential: SSH.

The pattern is applied to the process list on the Probeward side. It is never put on a command line. The command run is always env LC_ALL=C ps -eww -o rss=,pcpu=,args= 2>/dev/null || { echo probeward-busybox-ps; env LC_ALL=C ps -o rss=,args=; }, whatever the parameters. The ps of the poll itself and the shell that runs it are not counted.

On the target ​

ps from procps, or BusyBox's ps. BusyBox's has neither -e, -w nor a CPU column (Alpine's is one): the first form fails there, the second runs, and the sensor then counts the processes and sums their memory but reports cpu_pct as unknown, and says so in the message (this ps reports no CPU use). Install procps (apk add procps) on such a target if the CPU figure matters. The sensor needs an account that can see all processes, which is every account unless /proc is mounted with hidepid. Under hidepid the account sees only its own processes and the count is wrong; use a group with gid= for the mount option. See Linux over SSH.

Failures ​

MessageMeaning
ps printed no processes (is the procps ps installed on the target?) (kind protocol)No usable ps.
SSH errorsAs for ssh_disk.

AGPL-3.0-only