Traffic
- async OPNsenseClient.get_interface_traffic()
Return a normalized diagnostics traffic snapshot.
- Returns:
- Normalized diagnostics traffic sample. Returns an
empty traffic sample when endpoint probing or response parsing fails.
- Return type:
- Raises:
AttributeError – Caught from endpoint probing or payload normalization and mapped when error propagation is enabled.
OPNsenseError – Re-raised from an OPNsense client operation when error propagation is enabled.
RuntimeError – Caught from endpoint probing or payload normalization and mapped when error propagation is enabled.
TimeoutError – Caught from endpoint probing or payload normalization and mapped when error propagation is enabled.
TypeError – Caught from endpoint probing or payload normalization and mapped when error propagation is enabled.
ValueError – Caught from endpoint probing or payload normalization and mapped when error propagation is enabled.
_map_opnsense_exception – Maps caught non-OPNsense errors to a public OPNsense exception when error propagation is enabled.
- async OPNsenseClient.stream_interface_traffic(poll_interval=1)
Yield normalized diagnostics traffic stream samples.
- Parameters:
poll_interval (int) – Requested stream interval in seconds. Values below 1 are clamped to 1, and the clamped value selects the stream endpoint.
- Yields:
dict[str, Any] –
- Normalized traffic samples after the initial valid timing
event is discarded because it cannot represent an interval delta. Later samples use elapsed time between strictly increasing server timestamps; after a timing reset, the next valid sample uses the selected stream interval.
- Raises:
AttributeError – Caught while probing the stream endpoint and mapped when error propagation is enabled.
OPNsenseError – Re-raised from an OPNsense client operation when error propagation is enabled.
RuntimeError – Caught while probing the stream endpoint and mapped when error propagation is enabled.
TimeoutError – Caught while probing the stream endpoint and mapped when error propagation is enabled.
TypeError – Caught while probing the stream endpoint and mapped when error propagation is enabled.
ValueError – Caught while probing the stream endpoint and mapped when error propagation is enabled.
_map_opnsense_exception – Maps caught non-OPNsense errors to a public OPNsense exception when error propagation is enabled.
- Return type:
AsyncIterator[dict[str, Any]]