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.

Examples

banshee/examples-collection/examples/watches/

missing

Example: the watch missing, expected elements absent; the interfaces of a Linux by SSH.

  • example
  • watch
  • missing
  • per
  • interfaces
  • ssh

by banshee1 installation1 version

v1Latest

Published on October 27, 2026. First version in this collection.

Keen 1.0.0 · 16 lines
// The watch "missing": it raises when elements that are expected are absent. It looks at every element
// returned, whatever the selection keeps.
// The collector reads the network interfaces of a Linux, by SSH.
need('protocol:ssh');

per('interface', 'Interfaces');
output('state', 'text', array('label' => 'State', 'per' => 'interface'));

watch.missing('gone', 'Interface missing', 'state', array('critical' => array('eth0')));

// One line per interface, "eth0/operstate:up".
$read = ssh.run('cd /sys/class/net && grep -H . */operstate');
foreach (text.lines($read['output']) as $line) {
    $m = text.match($line, '^([^/]+)/operstate:(.*)$');
    value('state', $m[2], $m[1]);
}