Examples
banshee/examples-collection/examples/basics/
first-collector
Example: the smallest collector, one SSH command, one value, one watch.
by banshee1 installation1 version
Published on October 27, 2026. First version in this collection.
// A first collector: it reads one number on a Linux by SSH, returns it, and proposes one watch.
// A collector has two parts. The header comes first: it declares what the collector needs, what it
// returns and what it watches, and the master reads it without running anything. The body comes after:
// it does the work, on the poller.
// What it needs: the SSH access of the host (its address, an account, its host key), set in the tree.
need('protocol:ssh');
// What it returns: one number, named users.
output('users', 'number', array('label' => 'Logged-in users'));
// What it watches: a warning above 5 users, critical above 20. The administrator changes both on the probe.
watch.above('crowded', 'Too many users', 'users', array('warning' => 5, 'critical' => 20));
// The body: run a command, read what it printed, return the value.
$answer = ssh.run('who | wc -l');
value('users', text.trim($answer['output']));