banshee is under active development: collectors will keep changing, and a version you publish will likely need adjustments. For stable use, wait for 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

by banshee1 installation1 version

v1Latest

Published on October 27, 2026. First version in this collection.

Watch: state

watch.state raises when a value takes one of the states of a list: here, the state of a systemd service, failed critical, inactive a warning.

How to read it

  • watch.state('down', 'Service down', 'state', array('warning' => array(…), 'critical' => array(…))): an id, the title the administrator reads, the output it watches, and for each level the list of values that raise it. Any other value raises nothing.
  • The output can be a text or a number; a number in the list counts as its writing ('2' and 2 are the same).
  • systemctl is-active exits non-zero for a service that is not active: ssh.run returns that as an answer, and the collector reads the word printed.

To adapt it

  • Change sshd for the service to watch, or return one state per service with per (see examples/mechanics/selection-only).
  • The opposite question, "anything but these values", is watch.expect (see examples/watches/expect).