Examples
banshee/examples-collection/examples/protocols/
ssh-run
Example: ssh.run, its output, errors and exit, and arguments=; the size of a file.
par banshee1 installation1 version
Publiée le 27 octobre 2026. First version in this collection.
Protocol: ssh.run
ssh.run runs a command on the host by SSH and returns array('output' => …, 'errors' => …, 'exit' => …): what it printed, what it printed as errors, and its exit code. Here, the size of one file.
How to read it
need('protocol:ssh')declares the SSH access: the address, the account, the host key and its fingerprint, the port, the delay, the password or the private key, all set in the tree.- A command that exits non-zero is an answer:
staton a missing file exits 1, and the collector says so,fail('critical', …). A connection that fails, a refused account, stops the collector by itself (seeexamples/mechanics/errors). arguments=array($path): each argument goes apart and protected; a path that holds a blank, a quote or a;stays one argument. Never glue a value into the command:'stat -c %s ' . $pathwould run whatever the path holds.- What the command does on the host is the author's judgement: use an account without write rights.
To adapt it
variable('example:file:path', …)is the setting of the probe (seeexamples/mechanics/variables).stat -c %sis GNU and BusyBox; on a BSD,stat -f %z.