|
|
@ -1183,91 +1183,6 @@ CREATE TRIGGER trigger_ip_addresses |
|
|
|
FOR EACH ROW EXECUTE PROCEDURE history_ip_addresses(); |
|
|
|
FOR EACH ROW EXECUTE PROCEDURE history_ip_addresses(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
|
|
TODO - This will be added only if we need to use it if the existing network tables aren't sufficient |
|
|
|
|
|
|
|
-- This stores information about network interfaces on hosts. It is mainly used to match a MAC address to a |
|
|
|
|
|
|
|
-- host. Given that it is possible that network devices can move, the linkage to the host_uuid can change. |
|
|
|
|
|
|
|
CREATE TABLE network_manager ( |
|
|
|
|
|
|
|
network_manager_uuid uuid not null primary key, -- Unlike most other tables, this UUID comes from nmcli itself, and so this matches what's displayed nmcli |
|
|
|
|
|
|
|
network_manager_host_uuid uuid not null, -- The host_uuid for this interface |
|
|
|
|
|
|
|
network_manager_device text not null, -- This is the nmcli "device" name |
|
|
|
|
|
|
|
network_manager_name text not null, -- This is the nmcli "name" name |
|
|
|
|
|
|
|
network_manager_mac text not null, -- This is the MAC address of the interface |
|
|
|
|
|
|
|
network_manager_type text not null, -- This is the nmcli "type" string |
|
|
|
|
|
|
|
network_manager_active text not null, -- This is the nmcli "active" field |
|
|
|
|
|
|
|
network_manager_state text not null, -- This is the nmcli "state" field |
|
|
|
|
|
|
|
network_manager_connected numeric not null, -- This is '0' if the connection is down, or a unix timestamp if it's up. |
|
|
|
|
|
|
|
network_manager_mtu numeric not null, -- This is the MTU of the interface |
|
|
|
|
|
|
|
modified_date timestamp with time zone not null, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FOREIGN KEY(network_manager_host_uuid) REFERENCES hosts(host_uuid) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
ALTER TABLE network_manager OWNER TO admin; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE history.network_manager ( |
|
|
|
|
|
|
|
history_id bigserial, |
|
|
|
|
|
|
|
network_manager_uuid uuid not null, |
|
|
|
|
|
|
|
network_manager_host_uuid uuid, |
|
|
|
|
|
|
|
network_manager_mac_address text, |
|
|
|
|
|
|
|
network_manager_name text, |
|
|
|
|
|
|
|
network_manager_speed bigint, |
|
|
|
|
|
|
|
network_manager_mtu bigint, |
|
|
|
|
|
|
|
network_manager_link_state text, |
|
|
|
|
|
|
|
network_manager_operational text, |
|
|
|
|
|
|
|
network_manager_duplex text, |
|
|
|
|
|
|
|
network_manager_medium text, |
|
|
|
|
|
|
|
network_manager_bond_uuid uuid, |
|
|
|
|
|
|
|
network_manager_bridge_uuid uuid, |
|
|
|
|
|
|
|
modified_date timestamp with time zone not null |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
ALTER TABLE history.network_manager OWNER TO admin; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE FUNCTION history_network_manager() RETURNS trigger |
|
|
|
|
|
|
|
AS $$ |
|
|
|
|
|
|
|
DECLARE |
|
|
|
|
|
|
|
history_network_manager RECORD; |
|
|
|
|
|
|
|
BEGIN |
|
|
|
|
|
|
|
SELECT INTO history_network_manager * FROM network_manager WHERE network_manager_uuid = new.network_manager_uuid; |
|
|
|
|
|
|
|
INSERT INTO history.network_manager |
|
|
|
|
|
|
|
(network_manager_uuid, |
|
|
|
|
|
|
|
network_manager_host_uuid, |
|
|
|
|
|
|
|
network_manager_mac_address, |
|
|
|
|
|
|
|
network_manager_name, |
|
|
|
|
|
|
|
network_manager_speed, |
|
|
|
|
|
|
|
network_manager_mtu, |
|
|
|
|
|
|
|
network_manager_link_state, |
|
|
|
|
|
|
|
network_manager_operational, |
|
|
|
|
|
|
|
network_manager_duplex, |
|
|
|
|
|
|
|
network_manager_medium, |
|
|
|
|
|
|
|
network_manager_bond_uuid, |
|
|
|
|
|
|
|
network_manager_bridge_uuid, |
|
|
|
|
|
|
|
modified_date) |
|
|
|
|
|
|
|
VALUES |
|
|
|
|
|
|
|
(history_network_manager.network_manager_uuid, |
|
|
|
|
|
|
|
history_network_manager.network_manager_host_uuid, |
|
|
|
|
|
|
|
history_network_manager.network_manager_mac_address, |
|
|
|
|
|
|
|
history_network_manager.network_manager_name, |
|
|
|
|
|
|
|
history_network_manager.network_manager_speed, |
|
|
|
|
|
|
|
history_network_manager.network_manager_mtu, |
|
|
|
|
|
|
|
history_network_manager.network_manager_link_state, |
|
|
|
|
|
|
|
history_network_manager.network_manager_operational, |
|
|
|
|
|
|
|
history_network_manager.network_manager_duplex, |
|
|
|
|
|
|
|
history_network_manager.network_manager_medium, |
|
|
|
|
|
|
|
history_network_manager.network_manager_bond_uuid, |
|
|
|
|
|
|
|
history_network_manager.network_manager_bridge_uuid, |
|
|
|
|
|
|
|
history_network_manager.modified_date); |
|
|
|
|
|
|
|
RETURN NULL; |
|
|
|
|
|
|
|
END; |
|
|
|
|
|
|
|
$$ |
|
|
|
|
|
|
|
LANGUAGE plpgsql; |
|
|
|
|
|
|
|
ALTER FUNCTION history_network_manager() OWNER TO admin; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TRIGGER trigger_network_manager |
|
|
|
|
|
|
|
AFTER INSERT OR UPDATE ON network_manager |
|
|
|
|
|
|
|
FOR EACH ROW EXECUTE PROCEDURE history_network_manager(); |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- This stores files made available to Anvil! systems and DR hosts. |
|
|
|
-- This stores files made available to Anvil! systems and DR hosts. |
|
|
|
CREATE TABLE files ( |
|
|
|
CREATE TABLE files ( |
|
|
|
file_uuid uuid not null primary key, |
|
|
|
file_uuid uuid not null primary key, |
|
|
|