Examples
banshee/examples-collection/examples/watches/
missing
Example: the watch missing, expected elements absent; the interfaces of a Linux by SSH.
par banshee1 installation1 version
Publiée le 27 octobre 2026. First version in this collection.
// 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]);
}