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
MetricCollectorover hosts, oneMonitorTargeteach.Silences host logging (collection is chatty) and chooses each host’s collection mode: :rtype:
MetricCollectora host with an
snmpblock is polled over SNMP — itsSnmpOptionsbecomes a liveSnmpClient(address defaulting to the host’s ownip) 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;
Nonemeans in-memory.