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/

state

Example: the watch state, raised by a value in a list; a systemd service by SSH.

  • example
  • watch
  • state
  • systemd
  • ssh

par banshee1 installation1 version

v1Dernière

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

Keen 1.0.0 · 13 lignes
// The watch "state": it raises when a value takes one of the states of a list.
// The collector reads whether a systemd service is running, by SSH.
need('protocol:ssh');

output('state', 'text', array('label' => 'State of the service'));

// failed raises critical, inactive a warning; any other state (active, activating...) raises nothing.
watch.state('down', 'Service down', 'state', array('warning' => array('inactive'), 'critical' => array('failed')));

// systemctl is-active prints one word, and exits non-zero when the service is not active: that is an
// answer, read in output, not a failure.
$answer = ssh.run('systemctl is-active sshd');
value('state', text.trim($answer['output']));