@ -135,7 +135,7 @@ CREATE TRIGGER trigger_host_variable
-- This stores alerts coming in from various sources
CREATE TABLE alerts (
alert_uuid uuid primary key ,
alert_uuid uuid not null primary key ,
alert_host_uuid uuid not null , -- The name of the node or dashboard that this alert came from.
alert_set_by text not null ,
alert_level text not null , -- debug (log only), info (+ admin email), notice (+ curious users), warning (+ client technical staff), critical (+ all)
@ -210,7 +210,7 @@ CREATE TRIGGER trigger_alerts
-- This holds user-configurable variable. These values override defaults but NOT configuration files.
CREATE TABLE variables (
variable_uuid uuid not null primary key , --
variable_uuid uuid not null primary key ,
variable_name text not null , -- This is the 'x::y::z' style variable name.
variable_value text , -- It is up to the software to sanity check variable values before they are stored
variable_default text , -- This acts as a reference for the user should they want to roll-back changes.
@ -335,53 +335,6 @@ CREATE TRIGGER trigger_jobs
AFTER INSERT OR UPDATE ON jobs
FOR EACH ROW EXECUTE PROCEDURE history_jobs ( ) ;
-- ------------------------------------------------------------------------------------------------------- --
-- These are special tables with no history or tracking UUIDs that simply record transient information. --
-- ------------------------------------------------------------------------------------------------------- --
-- This table records the last time a scan ran. It's sole purpose is to make sure at least one table's
-- 'modified_date' changes per run, so that database resyncs can be triggered reliably.
CREATE TABLE updated (
updated_host_uuid uuid not null ,
updated_by text not null , -- The name of the agent (or "ScanCore' itself) that updated.
modified_date timestamp with time zone not null ,
FOREIGN KEY ( updated_host_uuid ) REFERENCES hosts ( host_uuid )
) ;
ALTER TABLE updated OWNER TO #!variable!user!#;
-- To avoid "waffling" when a sensor is close to an alert (or cleared) threshold, a gap between the alarm
-- value and the clear value is used. If the sensor climbs above (or below) the "clear" value, but didn't
-- previously pass the "alert" threshold, we DON'T want to send an "all clear" message. So do solve that,
-- this table is used by agents to record when a warning message was sent.
CREATE TABLE alert_sent (
alert_sent_uuid uuid primary key ,
alert_sent_host_uuid uuid not null , -- The node associated with this alert
alert_set_by text not null , -- name of the program that set this alert
alert_record_locator text not null , -- String used by the agent to identify the source of the alert (ie: UPS serial number)
alert_name text not null , -- A free-form name used by the caller to identify this alert.
modified_date timestamp with time zone not null ,
FOREIGN KEY ( alert_sent_host_uuid ) REFERENCES hosts ( host_uuid )
) ;
ALTER TABLE updated OWNER TO #!variable!user!#;
-- This stores state information, like the whether migrations are happening and so on.
CREATE TABLE states (
state_uuid uuid primary key ,
state_name text not null , -- This is the name of the state (ie: 'migration', etc)
state_host_uuid uuid not null , -- The UUID of the machine that the state relates to. In migrations, this is the UUID of the target
state_note text , -- This is a free-form note section that the application setting the state can use for extra information (like the name of the server being migrated)
modified_date timestamp with time zone not null ,
FOREIGN KEY ( state_host_uuid ) REFERENCES hosts ( host_uuid )
) ;
ALTER TABLE states OWNER TO #!variable!user!#;
-- NOTE: network_interfaces, network_bonds and network_bridges are all used by scan-network (which doesn't
-- exist yet).
@ -469,7 +422,7 @@ CREATE TRIGGER trigger_network_interfaces
-- This stores information about network bonds (mode=1) on a hosts.
CREATE TABLE bonds (
bond_uuid uuid primary key ,
bond_uuid uuid not null primary key ,
bond_host_uuid uuid not null ,
bond_name text not null ,
bond_mode integer not null , -- This is the numerical bond type (will translate to the user's language in ScanCore)
@ -552,7 +505,7 @@ CREATE TRIGGER trigger_bonds
-- This stores information about network bridges.
CREATE TABLE bridges (
bridge_uuid uuid primary key ,
bridge_uuid uuid not null primary key ,
bridge_host_uuid uuid not null ,
bridge_name text not null ,
bridge_id text ,
@ -606,3 +559,50 @@ CREATE TRIGGER trigger_bridges
AFTER INSERT OR UPDATE ON bridges
FOR EACH ROW EXECUTE PROCEDURE history_bridges ( ) ;
-- ------------------------------------------------------------------------------------------------------- --
-- These are special tables with no history or tracking UUIDs that simply record transient information. --
-- ------------------------------------------------------------------------------------------------------- --
-- This table records the last time a scan ran. It's sole purpose is to make sure at least one table's
-- 'modified_date' changes per run, so that database resyncs can be triggered reliably.
CREATE TABLE updated (
updated_host_uuid uuid not null ,
updated_by text not null , -- The name of the agent (or "ScanCore' itself) that updated.
modified_date timestamp with time zone not null ,
FOREIGN KEY ( updated_host_uuid ) REFERENCES hosts ( host_uuid )
) ;
ALTER TABLE updated OWNER TO #!variable!user!#;
-- To avoid "waffling" when a sensor is close to an alert (or cleared) threshold, a gap between the alarm
-- value and the clear value is used. If the sensor climbs above (or below) the "clear" value, but didn't
-- previously pass the "alert" threshold, we DON'T want to send an "all clear" message. So do solve that,
-- this table is used by agents to record when a warning message was sent.
CREATE TABLE alert_sent (
alert_sent_uuid uuid not null primary key ,
alert_sent_host_uuid uuid not null , -- The node associated with this alert
alert_set_by text not null , -- name of the program that set this alert
alert_record_locator text not null , -- String used by the agent to identify the source of the alert (ie: UPS serial number)
alert_name text not null , -- A free-form name used by the caller to identify this alert.
modified_date timestamp with time zone not null ,
FOREIGN KEY ( alert_sent_host_uuid ) REFERENCES hosts ( host_uuid )
) ;
ALTER TABLE updated OWNER TO #!variable!user!#;
-- This stores state information, like the whether migrations are happening and so on.
CREATE TABLE states (
state_uuid uuid not null primary key ,
state_name text not null , -- This is the name of the state (ie: 'migration', etc)
state_host_uuid uuid not null , -- The UUID of the machine that the state relates to. In migrations, this is the UUID of the target
state_note text , -- This is a free-form note section that the application setting the state can use for extra information (like the name of the server being migrated)
modified_date timestamp with time zone not null ,
FOREIGN KEY ( state_host_uuid ) REFERENCES hosts ( host_uuid )
) ;
ALTER TABLE states OWNER TO #!variable!user!#;