opnsense_query_firewall_states
Inspect active firewall connection states to check live communications, verify host activity, and identify bandwidth-heavy clients using packet and byte counts.
Instructions
Query the pf state table to see connections currently tracked by the firewall.
States show what is happening now, while the log shows what happened. A host with many states to one destination is actively communicating; a host with none is not, regardless of what the rules permit. Byte and packet counts per state make this a good way to find which client is consuming a link.
Args: params (QueryStatesInput): Validated input containing: - filter (str): Address or port to match (default: "" = all states) - rule_id (str): Restrict to a specific rule id (default: "") - limit (int): Max states to return, 1-200 (default: 25) - offset (int): States to skip (default: 0) - response_format (ResponseFormat): 'markdown' or 'json'
Returns: str: Markdown table, or JSON with this schema: { "total": int, "count": int, "offset": int, "has_more": bool, "next_offset": int|null, "states": [ {"iface": str, "proto": str, "src_addr": str, "src_port": str, "dst_addr": str, "dst_port": str, "state": str, "packets": int, "bytes": int, "age": int, "expires": int, "id": str, "creatorid": str} ] }
Examples: - Use when: "Is this host talking to anything right now?" -> filter="192.168.30.57" - Use when: "What's saturating the WAN?" -> filter="", sort by bytes in the output - Don't use when: You need history (use opnsense_get_firewall_log)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |