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/mechanics/

inherit

Example: the option inherit of a variable, down, here or choice; the time zone of a Linux.

  • example
  • variable
  • inherit
  • timezone
  • ssh

par banshee1 installation1 version

v1Dernière

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

Keen 1.0.0 · 30 lignes
// The option inherit of a variable: how a value given on a node of the tree would reach the nodes under
// it. down: given on a node, it holds for everything under it. here: it holds on that node only. choice:
// the administrator says it each time. Today a variable of a collector is set on its probe only, so
// inherit changes nothing yet: it says what the author means for the day it can be set higher.
// The collector checks the time zone of a Linux, by SSH.
need('protocol:ssh');

// A time zone is the same for a whole site: set once on its folder, it would hold for every host in it.
$expected = variable('example:system:timezone', 'text', array(
    'label'   => 'Expected time zone',
    'help'    => 'For example Europe/Paris, or UTC.',
    'default' => 'UTC',
    'inherit' => 'down',
));

output('timezone', 'text', array('label' => 'Time zone'));
output('matches', 'text', array('label' => 'Time zone as expected'));

watch.state('wrong-timezone', 'Unexpected time zone', 'matches', array('warning' => array('no')));

// One line, "Europe/Paris".
$read = ssh.run('timedatectl show --property=Timezone --value');
$timezone = text.trim($read['output']);
value('timezone', $timezone);

$matches = 'no';
if ($timezone == $expected) {
    $matches = 'yes';
}
value('matches', $matches);