banshee est en développement actif : les collecteurs vont encore changer, et une version que vous publiez demandera sans doute des ajustements. Pour un usage stable, attendez la 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

par banshee1 installation1 version

v1Dernière

Publiée le 27 octobre 2026. First version in this collection.

Keen 1.0.0 · 16 lignes
// 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]);
}