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

functions

Example: functions of the author, parameters and return, on the memory of a Linux.

  • example
  • basics
  • functions
  • memory
  • ssh

par banshee1 installation1 version

v1Dernière

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

Functions

A function written once and called four times, and another called twice, on the memory and the swap of a Linux.

How to read it

  • function kilobytes($meminfo, $name) { … }: a name without a point, its parameters, its body. It is written at the first level of the code, never inside a block, before or after its calls.
  • A function sees only its parameters: the text of /proc/meminfo is passed to it, it does not read $meminfo of the body.
  • return gives back a value and leaves the function; percent returns 0 for a host without swap, rather than divide by zero.
  • fail works inside a function as everywhere: a line missing from /proc/meminfo stops the collector.
  • A function never calls itself, directly or through another: the validation refuses it.

To adapt it

  • kilobytes reads any line of /proc/meminfo: Cached, Dirty, HugePages_Total…
  • A function name cannot be a word of Keen (value, fail…) nor the name of a domain (text, http…).