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

http-get-json

Example: http.get and json.read; the state a health page declares.

  • example
  • protocol
  • http
  • json
  • health

by banshee1 installation1 version

v1Latest

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

Protocol: http.get and JSON

http.get sends a GET and returns array('status' => …, 'headers' => …, 'body' => …, 'time' => …): the code, the headers, the body as a text, the time in milliseconds. Here, a health page that answers {"status": "ok"}.

How to read it

  • need('protocol:http') is required by every http.get and http.post: it brings the TLS profile, the fingerprint and the User-Agent set in the tree. The address, itself, is written in the call.
  • A code 500 or 404 is an answer, read in status; the collector decides what it means, here fail('critical', …). A redirection is not followed: a 3xx comes back as it is.
  • json.read turns a JSON text into arrays: an object into keys, a list into 0, 1, 2… A text that is not JSON stops the collector, unreachable.
  • list.get($health, 'status', 'missing'): the key, or 'missing' when the page does not hold it.

To adapt it

  • A deeper key: $health['checks']['database'], or list.get at each level when it may be missing.
  • json.write does the other way, arrays into a JSON text (see examples/protocols/http-post).