diff options
author | Gibheer <gibheer+git@zero-knowledge.org> | 2018-12-11 12:37:30 +0100 |
---|---|---|
committer | Gibheer <gibheer+git@zero-knowledge.org> | 2018-12-11 12:37:30 +0100 |
commit | dece1ac2dc4554f66f8ec194269cd91d330edae1 (patch) | |
tree | 046475e3dcc818efd14d59ddc149e15192442fc9 /schema/20181210.sql | |
parent | c62916c46e1cdfb0e04a9f17dd72ff7048924c99 (diff) |
add level mappings
This allows to map the command exit codes to any other output level
which can then be reported by the notification plugin.
With the provided colors, the frontend will show them accordingly.
Diffstat (limited to 'schema/20181210.sql')
-rw-r--r-- | schema/20181210.sql | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/schema/20181210.sql b/schema/20181210.sql index 757055d..05236ca 100644 --- a/schema/20181210.sql +++ b/schema/20181210.sql @@ -1,3 +1,18 @@ +create table public.mappings( + id serial primary key, + name text not null, + description text not null +); + +create table public.mapping_level( + mapping_id integer not null, + source int not null, + target int not null, + title text not null, + color text not null, + unique(mapping_id, source) +); + CREATE TABLE public.notifier ( id serial NOT NULL primary key, name text NOT NULL @@ -10,10 +25,11 @@ CREATE TABLE public.groups ( CREATE TABLE public.nodes ( id bigserial NOT NULL primary key, + mapping_id int references mappings(id), name text NOT NULL, updated timestamp with time zone DEFAULT now() NOT NULL, created timestamp with time zone DEFAULT now() NOT NULL, - message text NOT NULL + message text NOT NULL, ); CREATE TABLE public.nodes_groups ( @@ -28,13 +44,14 @@ CREATE TABLE public.commands ( command text NOT NULL, updated timestamp with time zone DEFAULT now() NOT NULL, created timestamp with time zone DEFAULT now() NOT NULL, - message text NOT NULL + message text NOT NULL, ); CREATE TABLE public.checks ( id bigserial NOT NULL primary key, node_id integer not null references nodes(id) on delete cascade, command_id integer not null references commands(id) on delete restrict, + mapping_id int references mappings(id), intval interval DEFAULT '00:05:00'::interval NOT NULL, options jsonb DEFAULT '{}'::jsonb NOT NULL, updated timestamp with time zone DEFAULT now() NOT NULL, @@ -48,6 +65,7 @@ CREATE TABLE public.checks ( CREATE TABLE public.active_checks ( check_id bigint NOT NULL references checks(id) on delete cascade, + mapping_id int not null references mappings(id), cmdline text[] NOT NULL, next_time timestamp with time zone DEFAULT now() NOT NULL, states integer[] DEFAULT ARRAY[0] NOT NULL, |