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/

counter-rate

Example: counter.rate and skip; the incoming traffic of an interface in bit/s.

  • example
  • counter
  • rate
  • skip
  • traffic
  • ssh

par banshee1 installation1 version

v1Dernière

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

The rate of a counter

counter.rate turns a counter into a rate per second, from its reading at the previous pass; skip passes the turn while there is no rate yet. Here, the incoming traffic of one interface, in bit/s.

How to read it

  • counter.rate('in', $bytes * 8): a name, written as a text, and the counter. It keeps this reading for the next pass, and returns the difference with the previous one divided by the time between them.
  • It returns '' when there is no rate: at the first pass, after a gap of more than three intervals of the probe, or when the counter went back (a restart, a counter that wrapped).
  • skip('…') passes the turn: nothing is returned, the probe keeps its state, and the reason is shown in its detail.
  • One element per call: counter.rate('in', $bytes, $name) keeps one reading per element, for a collector with per. The same name and element twice in a pass stops the collector.

To adapt it

  • To have the rate at the first pass, read twice in the same pass (see examples/mechanics/wait).
  • The reading is kept with the cache of the probe, and forgotten when the probe changes collector or version.