Reworked assets table

This commit is contained in:
Matteo Biscosi 2024-12-30 12:37:05 +01:00
parent 24c3745810
commit a63dec0dcc
17 changed files with 544 additions and 486 deletions

View file

@ -825,6 +825,7 @@ CREATE TABLE IF NOT EXISTS `mitre_table_info` ON CLUSTER '$CLUSTER' (
/* ASSET */
/*
CREATE TABLE IF NOT EXISTS `asset_management` ON CLUSTER '$CLUSTER' (
`type` String NOT NULL,
`key` String NOT NULL,
@ -840,7 +841,29 @@ CREATE TABLE IF NOT EXISTS `asset_management` ON CLUSTER '$CLUSTER' (
`trigger_alert` Boolean NULL,
`device_status` String NULL
) ENGINE = ReplacingMergeTree() PRIMARY KEY (`key`) ORDER BY (`key`);
@
ALTER TABLE `asset_management` ADD COLUMN IF NOT EXISTS `ifid` UInt8;
*/
/* ASSET */
CREATE TABLE IF NOT EXISTS `assets` (
`type` String NOT NULL,
`key` String NOT NULL,
`ifid` UInt8 NOT NULL,
`ip` String NULL,
`mac` String NOT NULL,
`vlan` UInt16 NULL,
`network` UInt16 NULL,
`name` String NULL,
`device_type` UInt16 NULL,
`manufacturer` String NULL,
`first_seen` DateTime NOT NULL,
`last_seen` DateTime NOT NULL,
`gateway_mac` String NULL,
`json_info` String NULL, -- A json containing all other info
version UInt64 -- Used to not have duplicates
) ENGINE = ReplacingMergeTree(version) PRIMARY KEY (`type`, `key`) ORDER BY (`type`, `key`);
@
/* VIEWS */