Examples
banshee/examples-collection/examples/watches/
increase
Example: the watch increase on a counter over a window; out-of-memory kills by SSH.
par banshee1 installation1 version
Publiée le 27 octobre 2026. First version in this collection.
// The watch "increase": it raises when a counter, a number that only grows, grew too much over a window.
// The kernel of a Linux counts in oom_kill the processes it killed for lack of memory since its start.
need('protocol:ssh');
output('oom-kills', 'number', array('label' => 'Processes killed for lack of memory, since the start'));
// One kill within a day is a warning, three a critical. A restart brings the counter back to zero: the
// window then starts again from there.
watch.increase('oom', 'Out of memory', 'oom-kills', array('warning' => 0, 'critical' => 2, 'window' => '1 d'));
// "oom_kill 3", in /proc/vmstat since Linux 4.13.
$read = ssh.run("grep '^oom_kill ' /proc/vmstat");
$f = text.words($read['output']);
value('oom-kills', $f[1]);