Examples
banshee/examples-collection/examples/watches/
deviate
Example: the watch deviate, one element far from the others; the load of each processor by SNMP.
by banshee1 installation1 version
Published on October 27, 2026. First version in this collection.
// The watch "deviate": it raises when one element strays from the others of the same pass; here, a
// processor left idle while the others work. It needs a selection (per), and judges nothing under three
// elements.
// The collector reads the load of each processor, by SNMP.
need('protocol:snmp');
per('processor', 'Processors');
output('load', 'number', array('label' => 'Load of the processor', 'unit' => '%', 'per' => 'processor'));
// side below: only a value under the median of the others counts. 40 points under it is a warning, when
// it holds for 3 passes.
watch.deviate('neglected', 'A processor left idle', 'load', array('side' => 'below', 'warning' => 40, 'for' => '3 runs'));
// hrProcessorLoad (HOST-RESOURCES-MIB): the load of each processor over the last minute, in percent.
// The suffix of each OID is the index of the processor.
$loads = snmp.walk('1.3.6.1.2.1.25.3.3.1.2');
foreach ($loads as $index => $load) {
value('load', $load, 'cpu' . $index);
}