feat(snmp,ui): устройства за портом (MAC/IP) в таблице 2
Добавил сбор FDB/ARP по SNMP (BRIDGE-MIB + ipNetToMedia), хранение и API /port-devices. В UI Таблица 2 теперь показывает MAC/IP за выбранным портом после клика по строке Таблицы 1. Made-with: Cursor
This commit is contained in:
@@ -11,6 +11,9 @@ var initSQL string
|
||||
//go:embed sql/002_scan_interfaces.sql
|
||||
var scanInterfacesSQL string
|
||||
|
||||
//go:embed sql/003_scan_port_devices.sql
|
||||
var scanPortDevicesSQL string
|
||||
|
||||
func RunMigrations(db *sql.DB) error {
|
||||
if _, err := db.Exec(initSQL); err != nil {
|
||||
return err
|
||||
@@ -18,5 +21,8 @@ func RunMigrations(db *sql.DB) error {
|
||||
if _, err := db.Exec(scanInterfacesSQL); err != nil {
|
||||
return err
|
||||
}
|
||||
if _, err := db.Exec(scanPortDevicesSQL); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
create table if not exists scan_port_devices (
|
||||
id bigserial primary key,
|
||||
scan_id text not null references scan_jobs(id) on delete cascade,
|
||||
ip inet not null,
|
||||
if_index int not null,
|
||||
mac text not null,
|
||||
learned_ip inet null,
|
||||
checked_at timestamptz not null
|
||||
);
|
||||
|
||||
create index if not exists idx_scan_port_devices_scan_ip_if
|
||||
on scan_port_devices (scan_id, ip, if_index);
|
||||
|
||||
create index if not exists idx_scan_port_devices_scan_ip_mac
|
||||
on scan_port_devices (scan_id, ip, mac);
|
||||
Reference in New Issue
Block a user