- Added functionality to report per-IP drop counters in the `evofw-firewall.sh` script, capturing the top 200 IPs with packet counts. - Introduced new API endpoints to retrieve blocked IP statistics and reset these stats for agents, enhancing monitoring capabilities. - Updated the agent detail view to display blocked IPs, improving user visibility into agent performance. - Enhanced database schema and repositories to support the storage and management of IP block statistics. These changes provide a comprehensive view of blocked IPs, improving the overall management and monitoring of agents.
17 lines
714 B
SQL
17 lines
714 B
SQL
-- Per-IP/CIDR drop counters from Linux agent nft/ipset element counters.
|
|
CREATE TABLE IF NOT EXISTS agent_ip_block_stats (
|
|
id TEXT PRIMARY KEY NOT NULL,
|
|
agent_id TEXT NOT NULL REFERENCES agents(id) ON DELETE CASCADE,
|
|
ip TEXT NOT NULL,
|
|
packets INTEGER NOT NULL DEFAULT 0,
|
|
last_reported_packets INTEGER NOT NULL DEFAULT 0,
|
|
first_seen_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')),
|
|
last_seen_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))
|
|
);
|
|
|
|
CREATE UNIQUE INDEX IF NOT EXISTS idx_agent_ip_block_stats_agent_ip
|
|
ON agent_ip_block_stats(agent_id, ip);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_agent_ip_block_stats_agent_packets
|
|
ON agent_ip_block_stats(agent_id, packets);
|