monitor.factory

Shared monitor-collector factory.

Used by both otto monitor (live dashboard) and otto test --monitor (session-scoped collection during a test run). Centralising this here keeps both call sites consistent — same parser-registry lookup, same per-host log silencing, same target construction.

otto.monitor.factory.build_monitor_collector(hosts, db_path=None)

Build a MetricCollector over hosts, one MonitorTarget each.

Silences host logging (collection is chatty) and chooses each host’s collection mode: :rtype: MetricCollector

  • a host with an snmp block is polled over SNMP — its SnmpOptions becomes a live SnmpClient (address defaulting to the host’s own ip) plus the OID list to GET;

  • otherwise it is polled by running shell commands, with its parser set resolved via get_host_parsers() so per-host customisations registered by init modules are honoured.

Parameters:
  • hosts – Hosts to sample on each tick.

  • db_path – Optional SQLite file for persistence; None means in-memory.