diff --git a/n9e/compose-pgsql/docker-compose.yaml b/n9e/compose-pgsql/docker-compose.yaml new file mode 100644 index 0000000..af890e0 --- /dev/null +++ b/n9e/compose-pgsql/docker-compose.yaml @@ -0,0 +1,102 @@ + +networks: + nightingale: + driver: bridge + +services: + postgres: + # platform: linux/x86_64 + image: "postgres:12-alpine" + container_name: postgres + hostname: postgres + restart: always + ports: + - "5432:5432" + environment: + TZ: Asia/Shanghai + POSTGRES_USER: root + POSTGRES_PASSWORD: 1234 + POSTGRES_DB: n9e_v6 + PGDATA: /var/lib/postgresql/data/pgdata + volumes: + - ./pgdata:/var/lib/postgresql/data + - ./initsql_for_postgres:/docker-entrypoint-initdb.d/ + networks: + - nightingale + + redis: + image: "redis:8-alpine" + container_name: redis + hostname: redis + restart: always + ports: + - "6379:6379" + environment: + TZ: Asia/Shanghai + networks: + - nightingale + + victoriametrics: + image: victoriametrics/victoria-metrics:v1.126.0 + container_name: victoriametrics + hostname: victoriametrics + restart: always + environment: + TZ: Asia/Shanghai + ports: + - "8428:8428" + networks: + - nightingale + command: + - "--loggerTimezone=Asia/Shanghai" + + nightingale: + image: flashcatcloud/nightingale:8.3.1 + container_name: nightingale + hostname: nightingale + restart: always + environment: + GIN_MODE: release + TZ: Asia/Shanghai + WAIT_HOSTS: postgres:5432, redis:6379 + volumes: + - ./n9eetc_pg:/app/etc + ports: + - "17000:17000" + networks: + - nightingale + depends_on: + - postgres + - redis + - victoriametrics + links: + - postgres:postgres + - redis:redis + - victoriametrics:victoriametrics + command: > + sh -c "/app/n9e" + + categraf: + image: "flashcatcloud/categraf:latest" + container_name: "categraf" + hostname: "categraf01" + restart: always + environment: + TZ: Asia/Shanghai + HOST_PROC: /hostfs/proc + HOST_SYS: /hostfs/sys + HOST_MOUNT_PREFIX: /hostfs + WAIT_HOSTS: nightingale:17000, nightingale:20090 + volumes: + - ./categraf/conf:/etc/categraf/conf + - /:/hostfs + - /var/run/docker.sock:/var/run/docker.sock + - ./prometc_vm:/etc/prometheus + # ports: + # - "9100:9100/tcp" + networks: + - nightingale + depends_on: + - nightingale + links: + - nightingale:nightingale \ No newline at end of file diff --git a/n9e/compose-pgsql/initsql_for_postgres/a-n9e-for-Postgres.sql b/n9e/compose-pgsql/initsql_for_postgres/a-n9e-for-Postgres.sql new file mode 100644 index 0000000..ec7c7b0 --- /dev/null +++ b/n9e/compose-pgsql/initsql_for_postgres/a-n9e-for-Postgres.sql @@ -0,0 +1,1025 @@ +CREATE TABLE users ( + id bigserial, + username varchar(64) not null, + nickname varchar(64) not null, + password varchar(128) not null default '', + phone varchar(16) not null default '', + email varchar(64) not null default '', + portrait varchar(255) not null default '', + roles varchar(255) not null, + contacts varchar(1024), + maintainer int not null default 0, + belong varchar(16) not null default '', + last_active_time bigint not null default 0, + create_at bigint not null default 0, + create_by varchar(64) not null default '', + update_at bigint not null default 0, + update_by varchar(64) not null default '', + PRIMARY KEY (id), + UNIQUE (username) +); + +COMMENT ON COLUMN users.id IS 'id'; +COMMENT ON COLUMN users.username IS 'login name, cannot rename'; +COMMENT ON COLUMN users.nickname IS 'display name, chinese name'; +COMMENT ON COLUMN users.portrait IS 'portrait image url'; +COMMENT ON COLUMN users.roles IS 'Admin | Standard | Guest, split by space'; +COMMENT ON COLUMN users.contacts IS 'json e.g. {wecom:xx, dingtalk_robot_token:yy}'; +COMMENT ON COLUMN users.belong IS 'belong'; + +insert into users(id, username, nickname, password, roles, create_at, create_by, update_at, update_by) values(1, 'root', '超管', 'root.2020', 'Admin', date_part('epoch',current_timestamp)::int, 'system', date_part('epoch',current_timestamp)::int, 'system'); + +CREATE TABLE user_group ( + id bigserial, + name varchar(128) not null default '', + note varchar(255) not null default '', + create_at bigint not null default 0, + create_by varchar(64) not null default '', + update_at bigint not null default 0, + update_by varchar(64) not null default '', + PRIMARY KEY (id) +) ; +CREATE INDEX user_group_create_by_idx ON user_group (create_by); +CREATE INDEX user_group_update_at_idx ON user_group (update_at); + +insert into user_group(id, name, create_at, create_by, update_at, update_by) values(1, 'demo-root-group', date_part('epoch',current_timestamp)::int, 'root', date_part('epoch',current_timestamp)::int, 'root'); + +CREATE TABLE user_group_member ( + id bigserial, + group_id bigint not null, + user_id bigint not null, + PRIMARY KEY(id) +) ; +CREATE INDEX user_group_member_group_id_idx ON user_group_member (group_id); +CREATE INDEX user_group_member_user_id_idx ON user_group_member (user_id); + +insert into user_group_member(group_id, user_id) values(1, 1); + +CREATE TABLE configs ( + id bigserial, + ckey varchar(191) not null, + cval text not null default '', + note varchar(1024) not null default '', + external int not null default 0, + encrypted int not null default 0, + create_at bigint not null default 0, + create_by varchar(64) not null default '', + update_at bigint not null default 0, + update_by varchar(64) not null default '', + PRIMARY KEY (id), + UNIQUE (ckey) +); + +CREATE TABLE role ( + id bigserial, + name varchar(191) not null default '', + note varchar(255) not null default '', + PRIMARY KEY (id), + UNIQUE (name) +) ; + +insert into role(name, note) values('Admin', 'Administrator role'); +insert into role(name, note) values('Standard', 'Ordinary user role'); +insert into role(name, note) values('Guest', 'Readonly user role'); + +CREATE TABLE role_operation( + id bigserial, + role_name varchar(128) not null, + operation varchar(191) not null, + PRIMARY KEY(id) +) ; +CREATE INDEX role_operation_role_name_idx ON role_operation (role_name); +CREATE INDEX role_operation_operation_idx ON role_operation (operation); + + +-- Admin is special, who has no concrete operation but can do anything. +insert into role_operation(role_name, operation) values('Guest', '/metric/explorer'); +insert into role_operation(role_name, operation) values('Guest', '/object/explorer'); +insert into role_operation(role_name, operation) values('Guest', '/log/explorer'); +insert into role_operation(role_name, operation) values('Guest', '/trace/explorer'); +insert into role_operation(role_name, operation) values('Guest', '/help/version'); +insert into role_operation(role_name, operation) values('Guest', '/help/contact'); + +insert into role_operation(role_name, operation) values('Standard', '/metric/explorer'); +insert into role_operation(role_name, operation) values('Standard', '/object/explorer'); +insert into role_operation(role_name, operation) values('Standard', '/log/explorer'); +insert into role_operation(role_name, operation) values('Standard', '/trace/explorer'); +insert into role_operation(role_name, operation) values('Standard', '/help/version'); +insert into role_operation(role_name, operation) values('Standard', '/help/contact'); +insert into role_operation(role_name, operation) values('Standard', '/help/servers'); +insert into role_operation(role_name, operation) values('Standard', '/help/migrate'); + +insert into role_operation(role_name, operation) values('Standard', '/alert-rules-built-in'); +insert into role_operation(role_name, operation) values('Standard', '/dashboards-built-in'); +insert into role_operation(role_name, operation) values('Standard', '/trace/dependencies'); + +insert into role_operation(role_name, operation) values('Admin', '/help/source'); +insert into role_operation(role_name, operation) values('Admin', '/help/sso'); +insert into role_operation(role_name, operation) values('Admin', '/help/notification-tpls'); +insert into role_operation(role_name, operation) values('Admin', '/help/notification-settings'); + +insert into role_operation(role_name, operation) values('Standard', '/users'); +insert into role_operation(role_name, operation) values('Standard', '/user-groups'); +insert into role_operation(role_name, operation) values('Standard', '/user-groups/add'); +insert into role_operation(role_name, operation) values('Standard', '/user-groups/put'); +insert into role_operation(role_name, operation) values('Standard', '/user-groups/del'); +insert into role_operation(role_name, operation) values('Standard', '/busi-groups'); +insert into role_operation(role_name, operation) values('Standard', '/busi-groups/add'); +insert into role_operation(role_name, operation) values('Standard', '/busi-groups/put'); +insert into role_operation(role_name, operation) values('Standard', '/busi-groups/del'); +insert into role_operation(role_name, operation) values('Standard', '/targets'); +insert into role_operation(role_name, operation) values('Standard', '/targets/add'); +insert into role_operation(role_name, operation) values('Standard', '/targets/put'); +insert into role_operation(role_name, operation) values('Standard', '/targets/del'); +insert into role_operation(role_name, operation) values('Standard', '/dashboards'); +insert into role_operation(role_name, operation) values('Standard', '/dashboards/add'); +insert into role_operation(role_name, operation) values('Standard', '/dashboards/put'); +insert into role_operation(role_name, operation) values('Standard', '/dashboards/del'); +insert into role_operation(role_name, operation) values('Standard', '/alert-rules'); +insert into role_operation(role_name, operation) values('Standard', '/alert-rules/add'); +insert into role_operation(role_name, operation) values('Standard', '/alert-rules/put'); +insert into role_operation(role_name, operation) values('Standard', '/alert-rules/del'); +insert into role_operation(role_name, operation) values('Standard', '/alert-mutes'); +insert into role_operation(role_name, operation) values('Standard', '/alert-mutes/add'); +insert into role_operation(role_name, operation) values('Standard', '/alert-mutes/del'); +insert into role_operation(role_name, operation) values('Standard', '/alert-subscribes'); +insert into role_operation(role_name, operation) values('Standard', '/alert-subscribes/add'); +insert into role_operation(role_name, operation) values('Standard', '/alert-subscribes/put'); +insert into role_operation(role_name, operation) values('Standard', '/alert-subscribes/del'); +insert into role_operation(role_name, operation) values('Standard', '/alert-cur-events'); +insert into role_operation(role_name, operation) values('Standard', '/alert-cur-events/del'); +insert into role_operation(role_name, operation) values('Standard', '/alert-his-events'); +insert into role_operation(role_name, operation) values('Standard', '/job-tpls'); +insert into role_operation(role_name, operation) values('Standard', '/job-tpls/add'); +insert into role_operation(role_name, operation) values('Standard', '/job-tpls/put'); +insert into role_operation(role_name, operation) values('Standard', '/job-tpls/del'); +insert into role_operation(role_name, operation) values('Standard', '/job-tasks'); +insert into role_operation(role_name, operation) values('Standard', '/job-tasks/add'); +insert into role_operation(role_name, operation) values('Standard', '/job-tasks/put'); +insert into role_operation(role_name, operation) values('Standard', '/recording-rules'); +insert into role_operation(role_name, operation) values('Standard', '/recording-rules/add'); +insert into role_operation(role_name, operation) values('Standard', '/recording-rules/put'); +insert into role_operation(role_name, operation) values('Standard', '/recording-rules/del'); + +-- for alert_rule | collect_rule | mute | dashboard grouping +CREATE TABLE busi_group ( + id bigserial, + name varchar(191) not null, + label_enable smallint not null default 0, + label_value varchar(191) not null default '' , + create_at bigint not null default 0, + create_by varchar(64) not null default '', + update_at bigint not null default 0, + update_by varchar(64) not null default '', + PRIMARY KEY (id), + UNIQUE (name) +) ; +COMMENT ON COLUMN busi_group.label_value IS 'if label_enable: label_value can not be blank'; + +insert into busi_group(id, name, create_at, create_by, update_at, update_by) values(1, 'Default Busi Group', date_part('epoch',current_timestamp)::int, 'root', date_part('epoch',current_timestamp)::int, 'root'); + +CREATE TABLE busi_group_member ( + id bigserial, + busi_group_id bigint not null , + user_group_id bigint not null , + perm_flag char(2) not null , + PRIMARY KEY (id) +) ; +CREATE INDEX busi_group_member_busi_group_id_idx ON busi_group_member (busi_group_id); +CREATE INDEX busi_group_member_user_group_id_idx ON busi_group_member (user_group_id); +COMMENT ON COLUMN busi_group_member.busi_group_id IS 'busi group id'; +COMMENT ON COLUMN busi_group_member.user_group_id IS 'user group id'; +COMMENT ON COLUMN busi_group_member.perm_flag IS 'ro | rw'; + + +insert into busi_group_member(busi_group_id, user_group_id, perm_flag) values(1, 1, 'rw'); + +-- for dashboard new version +CREATE TABLE board ( + id bigserial, + group_id bigint not null default 0 , + name varchar(191) not null, + ident varchar(200) not null default '', + tags varchar(255) not null , + public smallint not null default 0 , + built_in smallint not null default 0 , + hide smallint not null default 0 , + public_cate bigint NOT NULL DEFAULT 0, + create_at bigint not null default 0, + create_by varchar(64) not null default '', + update_at bigint not null default 0, + update_by varchar(64) not null default '', + PRIMARY KEY (id), + UNIQUE (group_id, name) +) ; +CREATE INDEX board_ident_idx ON board (ident); +COMMENT ON COLUMN board.group_id IS 'busi group id'; +COMMENT ON COLUMN board.tags IS 'split by space'; +COMMENT ON COLUMN board.public IS '0:false 1:true'; +COMMENT ON COLUMN board.built_in IS '0:false 1:true'; +COMMENT ON COLUMN board.hide IS '0:false 1:true'; +COMMENT ON COLUMN board.public_cate IS '0 anonymous 1 login 2 busi'; + + +-- for dashboard new version +CREATE TABLE board_payload ( + id bigint not null , + payload text not null, + UNIQUE (id) +) ; +COMMENT ON COLUMN board_payload.id IS 'dashboard id'; + +-- deprecated +CREATE TABLE dashboard ( + id bigserial, + group_id bigint not null default 0 , + name varchar(191) not null, + tags varchar(255) not null , + configs varchar(8192) , + create_at bigint not null default 0, + create_by varchar(64) not null default '', + update_at bigint not null default 0, + update_by varchar(64) not null default '', + PRIMARY KEY (id), + UNIQUE (group_id, name) +) ; +COMMENT ON COLUMN dashboard.group_id IS 'busi group id'; +COMMENT ON COLUMN dashboard.tags IS 'split by space'; +COMMENT ON COLUMN dashboard.configs IS 'dashboard variables'; + +-- deprecated +-- auto create the first subclass 'Default chart group' of dashboard +CREATE TABLE chart_group ( + id bigserial, + dashboard_id bigint not null, + name varchar(255) not null, + weight int not null default 0, + PRIMARY KEY (id) +) ; +CREATE INDEX chart_group_dashboard_id_idx ON chart_group (dashboard_id); + +-- deprecated +CREATE TABLE chart ( + id bigserial, + group_id bigint not null , + configs text, + weight int not null default 0, + PRIMARY KEY (id) +) ; +CREATE INDEX chart_group_id_idx ON chart (group_id); +COMMENT ON COLUMN chart.group_id IS 'chart group id'; + + +CREATE TABLE chart_share ( + id bigserial, + cluster varchar(128) not null, + datasource_id bigint not null default 0, + configs text, + create_at bigint not null default 0, + create_by varchar(64) not null default '', + primary key (id) +) ; +CREATE INDEX chart_share_create_at_idx ON chart_share (create_at); + + +CREATE TABLE alert_rule ( + id bigserial, + group_id bigint not null default 0 , + cate varchar(128) not null, + datasource_ids varchar(255) not null default '' , + cluster varchar(128) not null, + name varchar(255) not null, + note varchar(1024) not null default '', + prod varchar(255) not null default '', + algorithm varchar(255) not null default '', + algo_params varchar(255), + delay int not null default 0, + severity smallint not null , + disabled smallint not null , + prom_for_duration int not null , + rule_config text not null , + prom_ql text not null , + prom_eval_interval int not null , + enable_stime varchar(255) not null default '00:00', + enable_etime varchar(255) not null default '23:59', + enable_days_of_week varchar(255) not null default '' , + enable_in_bg smallint not null default 0 , + notify_recovered smallint not null , + notify_channels varchar(255) not null default '' , + notify_groups varchar(255) not null default '' , + notify_repeat_step int not null default 0 , + notify_max_number int not null default 0 , + recover_duration int not null default 0 , + callbacks varchar(255) not null default '' , + runbook_url varchar(255), + append_tags varchar(255) not null default '' , + annotations text not null , + extra_config text not null , + create_at bigint not null default 0, + create_by varchar(64) not null default '', + update_at bigint not null default 0, + update_by varchar(64) not null default '', + PRIMARY KEY (id) +) ; +CREATE INDEX alert_rule_group_id_idx ON alert_rule (group_id); +CREATE INDEX alert_rule_update_at_idx ON alert_rule (update_at); +COMMENT ON COLUMN alert_rule.group_id IS 'busi group id'; +COMMENT ON COLUMN alert_rule.datasource_ids IS 'datasource ids'; +COMMENT ON COLUMN alert_rule.severity IS '1:Emergency 2:Warning 3:Notice'; +COMMENT ON COLUMN alert_rule.disabled IS '0:enabled 1:disabled'; +COMMENT ON COLUMN alert_rule.prom_for_duration IS 'prometheus for, unit:s'; +COMMENT ON COLUMN alert_rule.rule_config IS 'rule_config'; +COMMENT ON COLUMN alert_rule.prom_ql IS 'promql'; +COMMENT ON COLUMN alert_rule.prom_eval_interval IS 'evaluate interval'; +COMMENT ON COLUMN alert_rule.enable_stime IS '00:00'; +COMMENT ON COLUMN alert_rule.enable_etime IS '23:59'; +COMMENT ON COLUMN alert_rule.enable_days_of_week IS 'split by space: 0 1 2 3 4 5 6'; +COMMENT ON COLUMN alert_rule.enable_in_bg IS '1: only this bg 0: global'; +COMMENT ON COLUMN alert_rule.notify_recovered IS 'whether notify when recovery'; +COMMENT ON COLUMN alert_rule.notify_channels IS 'split by space: sms voice email dingtalk wecom'; +COMMENT ON COLUMN alert_rule.notify_groups IS 'split by space: 233 43'; +COMMENT ON COLUMN alert_rule.notify_repeat_step IS 'unit: min'; +COMMENT ON COLUMN alert_rule.recover_duration IS 'unit: s'; +COMMENT ON COLUMN alert_rule.callbacks IS 'split by space: http://a.com/api/x http://a.com/api/y'; +COMMENT ON COLUMN alert_rule.append_tags IS 'split by space: service=n9e mod=api'; +COMMENT ON COLUMN alert_rule.annotations IS 'annotations'; +COMMENT ON COLUMN alert_rule.extra_config IS 'extra_config'; + +CREATE TABLE alert_mute ( + id bigserial, + group_id bigint not null default 0 , + prod varchar(255) not null default '', + note varchar(1024) not null default '', + cate varchar(128) not null, + cluster varchar(128) not null, + datasource_ids varchar(255) not null default '' , + tags jsonb NOT NULL , + cause varchar(255) not null default '', + btime bigint not null default 0 , + etime bigint not null default 0 , + disabled smallint not null default 0 , + mute_time_type smallint not null default 0, + periodic_mutes varchar(4096) not null default '', + severities varchar(32) not null default '', + create_at bigint not null default 0, + create_by varchar(64) not null default '', + update_at bigint not null default 0, + update_by varchar(64) not null default '', + PRIMARY KEY (id) +) ; +CREATE INDEX alert_mute_group_id_idx ON alert_mute (group_id); +CREATE INDEX alert_mute_update_at_idx ON alert_mute (update_at); +COMMENT ON COLUMN alert_mute.group_id IS 'busi group id'; +COMMENT ON COLUMN alert_mute.datasource_ids IS 'datasource ids'; +COMMENT ON COLUMN alert_mute.tags IS 'json,map,tagkey->regexp|value'; +COMMENT ON COLUMN alert_mute.btime IS 'begin time'; +COMMENT ON COLUMN alert_mute.etime IS 'end time'; +COMMENT ON COLUMN alert_mute.disabled IS '0:enabled 1:disabled'; + + +CREATE TABLE alert_subscribe ( + id bigserial, + name varchar(255) not null default '', + disabled int not null default 0, + group_id bigint not null default 0, + prod varchar(255) not null default '', + cate varchar(128) not null, + datasource_ids varchar(255) not null default '', + cluster varchar(128) not null, + rule_id bigint not null default 0, + severities varchar(32) not null default '', + tags varchar(4096) not null default '[]', + redefine_severity smallint default 0 , + new_severity smallint not null, + redefine_channels smallint default 0 , + new_channels varchar(255) not null default '', + user_group_ids varchar(250) not null, + busi_groups VARCHAR(4096) NOT NULL DEFAULT '[]', + note VARCHAR(1024) DEFAULT '', + rule_ids VARCHAR(1024) DEFAULT '', + webhooks text not null, + extra_config text not null, + redefine_webhooks int default 0, + for_duration bigint not null default 0, + create_at bigint not null default 0, + create_by varchar(64) not null default '', + update_at bigint not null default 0, + update_by varchar(64) not null default '', + PRIMARY KEY (id) +); + +CREATE INDEX ON alert_subscribe (update_at); +CREATE INDEX ON alert_subscribe (group_id); + +COMMENT ON COLUMN alert_subscribe.disabled IS '0:enabled 1:disabled'; +COMMENT ON COLUMN alert_subscribe.group_id IS 'busi group id'; +COMMENT ON COLUMN alert_subscribe.datasource_ids IS 'datasource ids'; +COMMENT ON COLUMN alert_subscribe.tags IS 'json,map,tagkey->regexp|value'; +COMMENT ON COLUMN alert_subscribe.redefine_severity IS 'is redefine severity?'; +COMMENT ON COLUMN alert_subscribe.new_severity IS '0:Emergency 1:Warning 2:Notice'; +COMMENT ON COLUMN alert_subscribe.redefine_channels IS 'is redefine channels?'; +COMMENT ON COLUMN alert_subscribe.new_channels IS 'split by space: sms voice email dingtalk wecom'; +COMMENT ON COLUMN alert_subscribe.user_group_ids IS 'split by space 1 34 5, notify cc to user_group_ids'; +COMMENT ON COLUMN alert_subscribe.note IS 'note'; +COMMENT ON COLUMN alert_subscribe.rule_ids IS 'rule_ids'; +COMMENT ON COLUMN alert_subscribe.extra_config IS 'extra_config'; + + +CREATE TABLE target ( + id bigserial, + group_id bigint not null default 0, + ident varchar(191) not null, + note varchar(255) not null default '', + tags varchar(512) not null default '', + host_tags text, + host_ip varchar(15) default '', + agent_version varchar(255) default '', + engine_name varchar(255) default '', + os varchar(31) default '', + update_at bigint not null default 0, + PRIMARY KEY (id), + UNIQUE (ident) +); + +CREATE INDEX ON target (group_id); +CREATE INDEX idx_host_ip ON target (host_ip); +CREATE INDEX idx_agent_version ON target (agent_version); +CREATE INDEX idx_engine_name ON target (engine_name); +CREATE INDEX idx_os ON target (os); + +COMMENT ON COLUMN target.group_id IS 'busi group id'; +COMMENT ON COLUMN target.ident IS 'target id'; +COMMENT ON COLUMN target.note IS 'append to alert event as field'; +COMMENT ON COLUMN target.tags IS 'append to series data as tags, split by space, append external space at suffix'; +COMMENT ON COLUMN target.host_tags IS 'global labels set in conf file'; +COMMENT ON COLUMN target.host_ip IS 'IPv4 string'; +COMMENT ON COLUMN target.agent_version IS 'agent version'; +COMMENT ON COLUMN target.engine_name IS 'engine_name'; +COMMENT ON COLUMN target.os IS 'os type'; + +CREATE TABLE metric_view ( + id bigserial, + name varchar(191) not null default '', + cate smallint not null , + configs varchar(8192) not null default '', + create_at bigint not null default 0, + create_by bigint not null default 0, + update_at bigint not null default 0, + PRIMARY KEY (id) +) ; +CREATE INDEX metric_view_create_by_idx ON metric_view (create_by); +COMMENT ON COLUMN metric_view.cate IS '0: preset 1: custom'; +COMMENT ON COLUMN metric_view.create_by IS 'user id'; + + +insert into metric_view(name, cate, configs) values('Host View', 0, '{"filters":[{"oper":"=","label":"__name__","value":"cpu_usage_idle"}],"dynamicLabels":[],"dimensionLabels":[{"label":"ident","value":""}]}'); + +CREATE TABLE recording_rule ( + id bigserial, + group_id bigint not null default '0', + datasource_ids varchar(255) not null default '', + cluster varchar(128) not null, + name varchar(255) not null , + note varchar(255) not null , + disabled smallint not null default 0 , + prom_ql varchar(8192) not null , + prom_eval_interval int not null , + append_tags varchar(255) default '' , + query_configs text not null , + create_at bigint default '0', + create_by varchar(64) default '', + update_at bigint default '0', + update_by varchar(64) default '', + PRIMARY KEY (id) +) ; +CREATE INDEX recording_rule_group_id_idx ON recording_rule (group_id); +CREATE INDEX recording_rule_update_at_idx ON recording_rule (update_at); +COMMENT ON COLUMN recording_rule.group_id IS 'group_id'; +COMMENT ON COLUMN recording_rule.datasource_ids IS 'datasource ids'; +COMMENT ON COLUMN recording_rule.name IS 'new metric name'; +COMMENT ON COLUMN recording_rule.note IS 'rule note'; +COMMENT ON COLUMN recording_rule.disabled IS '0:enabled 1:disabled'; +COMMENT ON COLUMN recording_rule.prom_ql IS 'promql'; +COMMENT ON COLUMN recording_rule.prom_eval_interval IS 'evaluate interval'; +COMMENT ON COLUMN recording_rule.append_tags IS 'split by space: service=n9e mod=api'; +COMMENT ON COLUMN recording_rule.query_configs IS 'query configs'; + + +CREATE TABLE alert_aggr_view ( + id bigserial, + name varchar(191) not null default '', + rule varchar(2048) not null default '', + cate smallint not null , + create_at bigint not null default 0, + create_by bigint not null default 0, + update_at bigint not null default 0, + PRIMARY KEY (id) +) ; +CREATE INDEX alert_aggr_view_create_by_idx ON alert_aggr_view (create_by); +COMMENT ON COLUMN alert_aggr_view.cate IS '0: preset 1: custom'; +COMMENT ON COLUMN alert_aggr_view.create_by IS 'user id'; + + +insert into alert_aggr_view(name, rule, cate) values('By BusiGroup, Severity', 'field:group_name::field:severity', 0); +insert into alert_aggr_view(name, rule, cate) values('By RuleName', 'field:rule_name', 0); + +CREATE TABLE alert_cur_event ( + id bigint not null , + cate varchar(128) not null, + datasource_id bigint not null default 0 , + cluster varchar(128) not null, + group_id bigint not null , + group_name varchar(255) not null default '' , + hash varchar(64) not null , + rule_id bigint not null, + rule_name varchar(255) not null, + rule_note varchar(2048) not null , + rule_prod varchar(255) not null default '', + rule_algo varchar(255) not null default '', + severity smallint not null , + prom_for_duration int not null , + prom_ql varchar(8192) not null , + prom_eval_interval int not null , + callbacks varchar(255) not null default '' , + runbook_url varchar(255), + notify_recovered smallint not null , + notify_channels varchar(255) not null default '' , + notify_groups varchar(255) not null default '' , + notify_repeat_next bigint not null default 0 , + notify_cur_number int not null default 0 , + target_ident varchar(191) not null default '' , + target_note varchar(191) not null default '' , + first_trigger_time bigint, + trigger_time bigint not null, + trigger_value varchar(2048) not null, + annotations text not null , + rule_config text not null , + tags varchar(1024) not null default '' , + PRIMARY KEY (id) +) ; +CREATE INDEX alert_cur_event_hash_idx ON alert_cur_event (hash); +CREATE INDEX alert_cur_event_rule_id_idx ON alert_cur_event (rule_id); +CREATE INDEX alert_cur_event_tg_idx ON alert_cur_event (trigger_time, group_id); +CREATE INDEX alert_cur_event_nrn_idx ON alert_cur_event (notify_repeat_next); +COMMENT ON COLUMN alert_cur_event.id IS 'use alert_his_event.id'; +COMMENT ON COLUMN alert_cur_event.datasource_id IS 'datasource id'; +COMMENT ON COLUMN alert_cur_event.group_id IS 'busi group id of rule'; +COMMENT ON COLUMN alert_cur_event.group_name IS 'busi group name'; +COMMENT ON COLUMN alert_cur_event.hash IS 'rule_id + vector_pk'; +COMMENT ON COLUMN alert_cur_event.rule_note IS 'alert rule note'; +COMMENT ON COLUMN alert_cur_event.severity IS '1:Emergency 2:Warning 3:Notice'; +COMMENT ON COLUMN alert_cur_event.prom_for_duration IS 'prometheus for, unit:s'; +COMMENT ON COLUMN alert_cur_event.prom_ql IS 'promql'; +COMMENT ON COLUMN alert_cur_event.prom_eval_interval IS 'evaluate interval'; +COMMENT ON COLUMN alert_cur_event.callbacks IS 'split by space: http://a.com/api/x http://a.com/api/y'; +COMMENT ON COLUMN alert_cur_event.notify_recovered IS 'whether notify when recovery'; +COMMENT ON COLUMN alert_cur_event.notify_channels IS 'split by space: sms voice email dingtalk wecom'; +COMMENT ON COLUMN alert_cur_event.notify_groups IS 'split by space: 233 43'; +COMMENT ON COLUMN alert_cur_event.notify_repeat_next IS 'next timestamp to notify, get repeat settings from rule'; +COMMENT ON COLUMN alert_cur_event.target_ident IS 'target ident, also in tags'; +COMMENT ON COLUMN alert_cur_event.target_note IS 'target note'; +COMMENT ON COLUMN alert_cur_event.annotations IS 'annotations'; +COMMENT ON COLUMN alert_cur_event.rule_config IS 'rule_config'; +COMMENT ON COLUMN alert_cur_event.tags IS 'merge data_tags rule_tags, split by ,,'; + + +CREATE TABLE alert_his_event ( + id bigserial, + is_recovered smallint not null, + cate varchar(128) not null, + datasource_id bigint not null default 0 , + cluster varchar(128) not null, + group_id bigint not null , + group_name varchar(255) not null default '' , + hash varchar(64) not null , + rule_id bigint not null, + rule_name varchar(255) not null, + rule_note varchar(2048) not null default 'alert rule note', + rule_prod varchar(255) not null default '', + rule_algo varchar(255) not null default '', + severity smallint not null , + prom_for_duration int not null , + prom_ql varchar(8192) not null , + prom_eval_interval int not null , + callbacks varchar(255) not null default '' , + runbook_url varchar(255), + notify_recovered smallint not null , + notify_channels varchar(255) not null default '' , + notify_groups varchar(255) not null default '' , + notify_cur_number int not null default 0 , + target_ident varchar(191) not null default '' , + target_note varchar(191) not null default '' , + first_trigger_time bigint, + trigger_time bigint not null, + trigger_value varchar(2048) not null, + recover_time bigint not null default 0, + last_eval_time bigint not null default 0 , + tags varchar(1024) not null default '' , + annotations text not null , + rule_config text not null , + PRIMARY KEY (id) +) ; +CREATE INDEX alert_his_event_hash_idx ON alert_his_event (hash); +CREATE INDEX alert_his_event_rule_id_idx ON alert_his_event (rule_id); +CREATE INDEX alert_his_event_tg_idx ON alert_his_event (trigger_time, group_id); +CREATE INDEX alert_his_event_nrn_idx ON alert_his_event (last_eval_time); +COMMENT ON COLUMN alert_his_event.group_id IS 'busi group id of rule'; +COMMENT ON COLUMN alert_his_event.datasource_id IS 'datasource id'; +COMMENT ON COLUMN alert_his_event.group_name IS 'busi group name'; +COMMENT ON COLUMN alert_his_event.hash IS 'rule_id + vector_pk'; +COMMENT ON COLUMN alert_his_event.rule_note IS 'alert rule note'; +COMMENT ON COLUMN alert_his_event.severity IS '0:Emergency 1:Warning 2:Notice'; +COMMENT ON COLUMN alert_his_event.prom_for_duration IS 'prometheus for, unit:s'; +COMMENT ON COLUMN alert_his_event.prom_ql IS 'promql'; +COMMENT ON COLUMN alert_his_event.prom_eval_interval IS 'evaluate interval'; +COMMENT ON COLUMN alert_his_event.callbacks IS 'split by space: http://a.com/api/x http://a.com/api/y'; +COMMENT ON COLUMN alert_his_event.notify_recovered IS 'whether notify when recovery'; +COMMENT ON COLUMN alert_his_event.notify_channels IS 'split by space: sms voice email dingtalk wecom'; +COMMENT ON COLUMN alert_his_event.notify_groups IS 'split by space: 233 43'; +COMMENT ON COLUMN alert_his_event.target_ident IS 'target ident, also in tags'; +COMMENT ON COLUMN alert_his_event.target_note IS 'target note'; +COMMENT ON COLUMN alert_his_event.last_eval_time IS 'for time filter'; +COMMENT ON COLUMN alert_his_event.tags IS 'merge data_tags rule_tags, split by ,,'; +COMMENT ON COLUMN alert_his_event.annotations IS 'annotations'; +COMMENT ON COLUMN alert_his_event.rule_config IS 'rule_config'; + +CREATE TABLE task_tpl +( + id serial, + group_id int not null , + title varchar(255) not null default '', + account varchar(64) not null, + batch int not null default 0, + tolerance int not null default 0, + timeout int not null default 0, + pause varchar(255) not null default '', + script text not null, + args varchar(512) not null default '', + tags varchar(255) not null default '' , + create_at bigint not null default 0, + create_by varchar(64) not null default '', + update_at bigint not null default 0, + update_by varchar(64) not null default '', + PRIMARY KEY (id) +) ; +CREATE INDEX task_tpl_group_id_idx ON task_tpl (group_id); +COMMENT ON COLUMN task_tpl.group_id IS 'busi group id'; +COMMENT ON COLUMN task_tpl.tags IS 'split by space'; + + +CREATE TABLE task_tpl_host +( + ii serial, + id int not null , + host varchar(128) not null , + PRIMARY KEY (ii) +) ; +CREATE INDEX task_tpl_host_id_host_idx ON task_tpl_host (id, host); +COMMENT ON COLUMN task_tpl_host.id IS 'task tpl id'; +COMMENT ON COLUMN task_tpl_host.host IS 'ip or hostname'; + + +CREATE TABLE task_record +( + id bigint not null , + event_id bigint not null default 0, + group_id bigint not null , + ibex_address varchar(128) not null, + ibex_auth_user varchar(128) not null default '', + ibex_auth_pass varchar(128) not null default '', + title varchar(255) not null default '', + account varchar(64) not null, + batch int not null default 0, + tolerance int not null default 0, + timeout int not null default 0, + pause varchar(255) not null default '', + script text not null, + args varchar(512) not null default '', + create_at bigint not null default 0, + create_by varchar(64) not null default '', + PRIMARY KEY (id) +) ; +CREATE INDEX task_record_cg_idx ON task_record (create_at, group_id); +CREATE INDEX task_record_create_by_idx ON task_record (create_by); +CREATE INDEX task_record_event_id_idx ON task_record (event_id); +COMMENT ON COLUMN task_record.id IS 'ibex task id'; +COMMENT ON COLUMN task_record.group_id IS 'busi group id'; +COMMENT ON COLUMN task_record.event_id IS 'event id'; + +CREATE TABLE alerting_engines +( + id serial, + instance varchar(128) not null default '' , + datasource_id bigint not null default 0 , + engine_cluster varchar(128) not null default '' , + clock bigint not null, + PRIMARY KEY (id) +) ; +COMMENT ON COLUMN alerting_engines.instance IS 'instance identification, e.g. 10.9.0.9:9090'; +COMMENT ON COLUMN alerting_engines.datasource_id IS 'datasource id'; +COMMENT ON COLUMN alerting_engines.engine_cluster IS 'target reader cluster'; + + +CREATE TABLE datasource +( + id serial, + name varchar(191) not null default '', + identifier varchar(255) not null default '', + description varchar(255) not null default '', + category varchar(255) not null default '', + plugin_id int not null default 0, + plugin_type varchar(255) not null default '', + plugin_type_name varchar(255) not null default '', + cluster_name varchar(255) not null default '', + settings text not null, + status varchar(255) not null default '', + http varchar(4096) not null default '', + auth varchar(8192) not null default '', + is_default boolean not null default false, + created_at bigint not null default 0, + created_by varchar(64) not null default '', + updated_at bigint not null default 0, + updated_by varchar(64) not null default '', + UNIQUE (name), + PRIMARY KEY (id) +) ; + +CREATE TABLE builtin_cate ( + id bigserial, + name varchar(191) not null, + user_id bigint not null default 0, + PRIMARY KEY (id) +) ; + +CREATE TABLE notify_tpl ( + id bigserial, + channel varchar(32) not null, + name varchar(255) not null, + content text not null, + create_at bigint not null default 0, + create_by varchar(64) not null default '', + update_at bigint not null default 0, + update_by varchar(64) not null default '', + PRIMARY KEY (id), + UNIQUE (channel) +); + +CREATE TABLE sso_config ( + id bigserial, + name varchar(191) not null, + content text not null, + update_at bigint not null default 0, + PRIMARY KEY (id), + UNIQUE (name) +); + + +CREATE TABLE es_index_pattern ( + id bigserial, + datasource_id bigint not null default 0, + name varchar(191) not null, + time_field varchar(128) not null default '@timestamp', + allow_hide_system_indices smallint not null default 0, + fields_format varchar(4096) not null default '', + cross_cluster_enabled int not null default 0, + create_at bigint default '0', + create_by varchar(64) default '', + update_at bigint default '0', + update_by varchar(64) default '', + note varchar(4096) not null default '', + PRIMARY KEY (id), + UNIQUE (datasource_id, name) +) ; +COMMENT ON COLUMN es_index_pattern.datasource_id IS 'datasource id'; +COMMENT ON COLUMN es_index_pattern.note IS 'description of metric in Chinese'; + +CREATE TABLE builtin_metrics ( + id bigserial, + collector varchar(191) NOT NULL, + typ varchar(191) NOT NULL, + name varchar(191) NOT NULL, + unit varchar(191) NOT NULL, + lang varchar(191) NOT NULL DEFAULT '', + note varchar(4096) NOT NULL, + expression varchar(4096) NOT NULL, + created_at bigint NOT NULL DEFAULT 0, + created_by varchar(191) NOT NULL DEFAULT '', + updated_at bigint NOT NULL DEFAULT 0, + updated_by varchar(191) NOT NULL DEFAULT '', + uuid BIGINT NOT NULL DEFAULT 0, + PRIMARY KEY (id), + UNIQUE (lang, collector, typ, name) +); + +CREATE INDEX idx_collector ON builtin_metrics (collector); +CREATE INDEX idx_typ ON builtin_metrics (typ); +CREATE INDEX idx_name ON builtin_metrics (name); +CREATE INDEX idx_lang ON builtin_metrics (lang); + +COMMENT ON COLUMN builtin_metrics.id IS 'unique identifier'; +COMMENT ON COLUMN builtin_metrics.collector IS 'type of collector'; +COMMENT ON COLUMN builtin_metrics.typ IS 'type of metric'; +COMMENT ON COLUMN builtin_metrics.name IS 'name of metric'; +COMMENT ON COLUMN builtin_metrics.unit IS 'unit of metric'; +COMMENT ON COLUMN builtin_metrics.lang IS 'language of metric'; +COMMENT ON COLUMN builtin_metrics.note IS 'description of metric in Chinese'; +COMMENT ON COLUMN builtin_metrics.expression IS 'expression of metric'; +COMMENT ON COLUMN builtin_metrics.created_at IS 'create time'; +COMMENT ON COLUMN builtin_metrics.created_by IS 'creator'; +COMMENT ON COLUMN builtin_metrics.updated_at IS 'update time'; +COMMENT ON COLUMN builtin_metrics.updated_by IS 'updater'; +COMMENT ON COLUMN builtin_metrics.uuid IS 'unique identifier'; + +CREATE TABLE metric_filter ( + id BIGSERIAL PRIMARY KEY, + name VARCHAR(191) NOT NULL, + configs VARCHAR(4096) NOT NULL, + groups_perm TEXT, + create_at BIGINT NOT NULL DEFAULT 0, + create_by VARCHAR(191) NOT NULL DEFAULT '', + update_at BIGINT NOT NULL DEFAULT 0, + update_by VARCHAR(191) NOT NULL DEFAULT '' +); + +CREATE INDEX idx_metric_filter_name ON metric_filter (name); + +CREATE TABLE board_busigroup ( + busi_group_id BIGINT NOT NULL DEFAULT 0, + board_id BIGINT NOT NULL DEFAULT 0, + PRIMARY KEY (busi_group_id, board_id) +); + + +CREATE TABLE builtin_components ( + id BIGSERIAL PRIMARY KEY, + ident VARCHAR(191) NOT NULL, + logo VARCHAR(191) NOT NULL, + readme TEXT NOT NULL, + disabled INT NOT NULL DEFAULT 0, + created_at BIGINT NOT NULL DEFAULT 0, + created_by VARCHAR(191) NOT NULL DEFAULT '', + updated_at BIGINT NOT NULL DEFAULT 0, + updated_by VARCHAR(191) NOT NULL DEFAULT '' +); + +CREATE INDEX idx_ident ON builtin_components (ident); + +CREATE TABLE builtin_payloads ( + id BIGSERIAL PRIMARY KEY, + type VARCHAR(191) NOT NULL, + uuid BIGINT NOT NULL DEFAULT 0, + component VARCHAR(191) NOT NULL, + cate VARCHAR(191) NOT NULL, + name VARCHAR(191) NOT NULL, + tags VARCHAR(191) NOT NULL DEFAULT '', + content TEXT NOT NULL, + created_at BIGINT NOT NULL DEFAULT 0, + created_by VARCHAR(191) NOT NULL DEFAULT '', + updated_at BIGINT NOT NULL DEFAULT 0, + updated_by VARCHAR(191) NOT NULL DEFAULT '' +); + +CREATE INDEX idx_component ON builtin_payloads (component); +CREATE INDEX idx_builtin_payloads_name ON builtin_payloads (name); +CREATE INDEX idx_cate ON builtin_payloads (cate); +CREATE INDEX idx_type ON builtin_payloads (type); + + +CREATE TABLE dash_annotation ( + id bigserial PRIMARY KEY, + dashboard_id bigint not null, + panel_id varchar(191) not null, + tags text, + description text, + config text, + time_start bigint not null default 0, + time_end bigint not null default 0, + create_at bigint not null default 0, + create_by varchar(64) not null default '', + update_at bigint not null default 0, + update_by varchar(64) not null default '' +); + +CREATE TABLE source_token ( + id bigserial PRIMARY KEY, + source_type varchar(64) NOT NULL DEFAULT '', + source_id varchar(255) NOT NULL DEFAULT '', + token varchar(255) NOT NULL DEFAULT '', + expire_at bigint NOT NULL DEFAULT 0, + create_at bigint NOT NULL DEFAULT 0, + create_by varchar(64) NOT NULL DEFAULT '' +); + +CREATE INDEX idx_source_token_type_id_token ON source_token (source_type, source_id, token); + +CREATE TABLE notification_record ( + id BIGSERIAL PRIMARY KEY, + notify_rule_id BIGINT NOT NULL DEFAULT 0, + event_id bigint NOT NULL, + sub_id bigint DEFAULT NULL, + channel varchar(255) NOT NULL, + status bigint DEFAULT NULL, + target varchar(1024) NOT NULL, + details varchar(2048) DEFAULT '', + created_at bigint NOT NULL +); + +CREATE INDEX idx_evt ON notification_record (event_id); + +COMMENT ON COLUMN notification_record.event_id IS 'event history id'; +COMMENT ON COLUMN notification_record.sub_id IS 'subscribed rule id'; +COMMENT ON COLUMN notification_record.channel IS 'notification channel name'; +COMMENT ON COLUMN notification_record.status IS 'notification status'; +COMMENT ON COLUMN notification_record.target IS 'notification target'; +COMMENT ON COLUMN notification_record.details IS 'notification other info'; +COMMENT ON COLUMN notification_record.created_at IS 'create time'; + +CREATE TABLE target_busi_group ( + id BIGSERIAL PRIMARY KEY, + target_ident varchar(191) NOT NULL, + group_id bigint NOT NULL, + update_at bigint NOT NULL +); + +CREATE UNIQUE INDEX idx_target_group ON target_busi_group (target_ident, group_id); + +CREATE TABLE user_token ( + id BIGSERIAL PRIMARY KEY, + username varchar(255) NOT NULL DEFAULT '', + token_name varchar(255) NOT NULL DEFAULT '', + token varchar(255) NOT NULL DEFAULT '', + create_at bigint NOT NULL DEFAULT 0, + last_used bigint NOT NULL DEFAULT 0 +); + +CREATE TABLE notify_rule ( + id bigserial PRIMARY KEY, + name varchar(255) NOT NULL, + description text, + enable boolean DEFAULT false, + user_group_ids varchar(255) NOT NULL DEFAULT '', + notify_configs text, + pipeline_configs text, + create_at bigint NOT NULL DEFAULT 0, + create_by varchar(64) NOT NULL DEFAULT '', + update_at bigint NOT NULL DEFAULT 0, + update_by varchar(64) NOT NULL DEFAULT '' +); + +CREATE TABLE notify_channel ( + id bigserial PRIMARY KEY, + name varchar(255) NOT NULL, + ident varchar(255) NOT NULL, + description text, + enable boolean DEFAULT false, + param_config text, + request_type varchar(50) NOT NULL, + request_config text, + weight int NOT NULL DEFAULT 0, + create_at bigint NOT NULL DEFAULT 0, + create_by varchar(64) NOT NULL DEFAULT '', + update_at bigint NOT NULL DEFAULT 0, + update_by varchar(64) NOT NULL DEFAULT '' +); + +CREATE TABLE message_template ( + id bigserial PRIMARY KEY, + name varchar(64) NOT NULL, + ident varchar(64) NOT NULL, + content text, + user_group_ids varchar(64), + notify_channel_ident varchar(64) NOT NULL DEFAULT '', + private int NOT NULL DEFAULT 0, + weight int NOT NULL DEFAULT 0, + create_at bigint NOT NULL DEFAULT 0, + create_by varchar(64) NOT NULL DEFAULT '', + update_at bigint NOT NULL DEFAULT 0, + update_by varchar(64) NOT NULL DEFAULT '' +); + +CREATE TABLE event_pipeline ( + id bigserial PRIMARY KEY, + name varchar(128) NOT NULL, + team_ids text, + description varchar(255) NOT NULL DEFAULT '', + filter_enable smallint NOT NULL DEFAULT 0, + label_filters text, + attribute_filters text, + processors text, + create_at bigint NOT NULL DEFAULT 0, + create_by varchar(64) NOT NULL DEFAULT '', + update_at bigint NOT NULL DEFAULT 0, + update_by varchar(64) NOT NULL DEFAULT '' +); + +CREATE TABLE embedded_product ( + id bigserial PRIMARY KEY, + name varchar(255) DEFAULT NULL, + url varchar(255) DEFAULT NULL, + is_private boolean DEFAULT NULL, + team_ids varchar(255), + create_at bigint NOT NULL DEFAULT 0, + create_by varchar(64) NOT NULL DEFAULT '', + update_at bigint NOT NULL DEFAULT 0, + update_by varchar(64) NOT NULL DEFAULT '' +); diff --git a/n9e/compose-pgsql/initsql_for_postgres/b-ibex-for-Postgres.sql b/n9e/compose-pgsql/initsql_for_postgres/b-ibex-for-Postgres.sql new file mode 100644 index 0000000..d75a819 --- /dev/null +++ b/n9e/compose-pgsql/initsql_for_postgres/b-ibex-for-Postgres.sql @@ -0,0 +1,1255 @@ +CREATE TABLE task_meta +( + id bigserial, + title varchar(255) not null default '', + account varchar(64) not null, + batch int not null default 0, + tolerance int not null default 0, + timeout int not null default 0, + pause varchar(255) not null default '', + script text not null, + args varchar(512) not null default '', + stdin varchar(1024) not null default '' , + creator varchar(64) not null default '', + created timestamp not null default CURRENT_TIMESTAMP, + PRIMARY KEY (id) +) ; +CREATE INDEX task_meta_creator_idx ON task_meta (creator); +CREATE INDEX task_meta_created_idx ON task_meta (created); + +/* start|cancel|kill|pause */ +CREATE TABLE task_action +( + id bigint not null, + action varchar(32) not null, + clock bigint not null default 0, + PRIMARY KEY (id) +) ; + +CREATE TABLE task_scheduler +( + id bigint not null, + scheduler varchar(128) not null default '' +) ; +CREATE INDEX task_scheduler_id_scheduler_idx ON task_scheduler (id, scheduler); + + +CREATE TABLE task_scheduler_health +( + scheduler varchar(128) not null, + clock bigint not null, + UNIQUE (scheduler) +) ; +CREATE INDEX task_scheduler_health_clock_idx ON task_scheduler_health (clock); + + +CREATE TABLE task_host_doing +( + id bigint not null, + host varchar(128) not null, + clock bigint not null default 0, + action varchar(16) not null +) ; +CREATE INDEX task_host_doing_id_idx ON task_host_doing (id); +CREATE INDEX task_host_doing_host_idx ON task_host_doing (host); + + +CREATE TABLE task_host_0 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_1 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_2 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_3 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_4 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_5 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_6 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_7 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_8 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_9 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_10 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_11 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_12 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_13 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_14 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_15 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_16 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_17 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_18 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_19 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_20 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_21 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_22 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_23 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_24 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_25 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_26 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_27 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_28 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_29 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_30 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_31 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_32 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_33 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_34 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_35 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_36 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_37 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_38 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_39 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_40 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_41 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_42 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_43 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_44 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_45 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_46 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_47 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_48 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_49 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_50 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_51 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_52 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_53 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_54 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_55 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_56 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_57 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_58 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_59 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_60 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_61 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_62 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_63 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_64 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_65 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_66 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_67 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_68 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_69 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_70 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_71 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_72 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_73 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_74 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_75 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_76 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_77 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_78 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_79 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_80 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_81 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_82 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_83 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_84 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_85 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_86 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_87 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_88 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_89 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_90 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_91 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_92 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_93 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_94 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_95 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_96 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_97 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_98 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; + +CREATE TABLE task_host_99 +( + ii bigserial, + id bigint not null, + host varchar(128) not null, + status varchar(32) not null, + stdout text, + stderr text, + UNIQUE (id, host), + PRIMARY KEY (ii) +) ; diff --git a/n9e/compose-pgsql/n9eetc_pg/config.toml b/n9e/compose-pgsql/n9eetc_pg/config.toml new file mode 100644 index 0000000..9a1a2dd --- /dev/null +++ b/n9e/compose-pgsql/n9eetc_pg/config.toml @@ -0,0 +1,177 @@ +[Global] +RunMode = "release" + +[Log] +# log write dir +Dir = "logs" +# log level: DEBUG INFO WARNING ERROR +Level = "INFO" +# stdout, stderr, file +Output = "stdout" +# # rotate by time +# KeepHours = 4 +# # rotate by size +# RotateNum = 3 +# # unit: MB +# RotateSize = 256 + +[HTTP] +# http listening address +Host = "0.0.0.0" +# http listening port +Port = 17000 +# https cert file path +CertFile = "" +# https key file path +KeyFile = "" +# whether print access log +PrintAccessLog = false +# whether enable pprof +PProf = false +# expose prometheus /metrics? +ExposeMetrics = true +# http graceful shutdown timeout, unit: s +ShutdownTimeout = 30 +# max content length: 64M +MaxContentLength = 67108864 +# http server read timeout, unit: s +ReadTimeout = 20 +# http server write timeout, unit: s +WriteTimeout = 40 +# http server idle timeout, unit: s +IdleTimeout = 120 + +[HTTP.ShowCaptcha] +Enable = false + +[HTTP.APIForAgent] +Enable = true +# [HTTP.APIForAgent.BasicAuth] +# user001 = "ccc26da7b9aba533cbb263a36c07dcc5" + +[HTTP.APIForService] +Enable = false +[HTTP.APIForService.BasicAuth] +user001 = "ccc26da7b9aba533cbb263a36c07dcc5" + +[HTTP.JWTAuth] +# unit: min +AccessExpired = 1500 +# unit: min +RefreshExpired = 10080 +RedisKeyPrefix = "/jwt/" + +[HTTP.ProxyAuth] +# if proxy auth enabled, jwt auth is disabled +Enable = false +# username key in http proxy header +HeaderUserNameKey = "X-User-Name" +DefaultRoles = ["Standard"] + +[HTTP.RSA] +# open RSA +OpenRSA = false +# RSA public key +RSAPublicKeyPath = "/etc/n9e/public.pem" +# RSA private key +RSAPrivateKeyPath = "/etc/n9e/private.pem" +# RSA private key password +RSAPassWord = "" + +[DB] +DSN="host=postgres port=5432 user=root dbname=n9e_v6 password=1234 sslmode=disable" +# enable debug mode or not +Debug = false +# mysql postgres +DBType = "postgres" +# unit: s +MaxLifetime = 7200 +# max open connections +MaxOpenConns = 150 +# max idle connections +MaxIdleConns = 50 +# enable auto migrate or not +# EnableAutoMigrate = false + +[Redis] +# address, ip:port or ip1:port,ip2:port for cluster and sentinel(SentinelAddrs) +Address = "redis:6379" +# Username = "" +# Password = "" +# DB = 0 +# UseTLS = false +# TLSMinVersion = "1.2" +# standalone cluster sentinel +RedisType = "standalone" +# Mastername for sentinel type +# MasterName = "mymaster" +# SentinelUsername = "" +# SentinelPassword = "" + +[Alert] +[Alert.Heartbeat] +# auto detect if blank +IP = "" +# unit ms +Interval = 1000 +EngineName = "default" + +# [Alert.Alerting] +# NotifyConcurrency = 10 + +[Center] +MetricsYamlFile = "./etc/metrics.yaml" +I18NHeaderKey = "X-Language" + +[Center.AnonymousAccess] +PromQuerier = true +AlertDetail = true + +[Pushgw] +# use target labels in database instead of in series +LabelRewrite = true +ForceUseServerTS = true + +# [Pushgw.DebugSample] +# ident = "xx" +# __name__ = "xx" + +# [Pushgw.WriterOpt] +# QueueMaxSize = 1000000 +# QueuePopSize = 1000 + +[[Pushgw.Writers]] +# Url = "http://127.0.0.1:8480/insert/0/prometheus/api/v1/write" +Url = "http://victoriametrics:8428/api/v1/write" +# Basic auth username +BasicAuthUser = "" +# Basic auth password +BasicAuthPass = "" +# timeout settings, unit: ms +Headers = ["X-From", "n9e"] +Timeout = 10000 +DialTimeout = 3000 +TLSHandshakeTimeout = 30000 +ExpectContinueTimeout = 1000 +IdleConnTimeout = 90000 +# time duration, unit: ms +KeepAlive = 30000 +MaxConnsPerHost = 0 +MaxIdleConns = 100 +MaxIdleConnsPerHost = 100 +## Optional TLS Config +# UseTLS = false +# TLSCA = "/etc/n9e/ca.pem" +# TLSCert = "/etc/n9e/cert.pem" +# TLSKey = "/etc/n9e/key.pem" +# InsecureSkipVerify = false +# [[Writers.WriteRelabels]] +# Action = "replace" +# SourceLabels = ["__address__"] +# Regex = "([^:]+)(?::\\d+)?" +# Replacement = "$1:80" +# TargetLabel = "__address__" + +[Ibex] +Enable = true +RPCListen = "0.0.0.0:20090" \ No newline at end of file diff --git a/n9e/compose-pgsql/n9eetc_pg/metrics.yaml b/n9e/compose-pgsql/n9eetc_pg/metrics.yaml new file mode 100644 index 0000000..ac97fb4 --- /dev/null +++ b/n9e/compose-pgsql/n9eetc_pg/metrics.yaml @@ -0,0 +1,494 @@ +cpu_usage_idle: CPU空闲率(单位:%) +cpu_usage_active: CPU使用率(单位:%) +cpu_usage_system: CPU内核态时间占比(单位:%) +cpu_usage_user: CPU用户态时间占比(单位:%) +cpu_usage_nice: 低优先级用户态CPU时间占比,也就是进程nice值被调整为1-19之间的CPU时间。这里注意,nice可取值范围是-20到19,数值越大,优先级反而越低(单位:%) +cpu_usage_iowait: CPU等待I/O的时间占比(单位:%) +cpu_usage_irq: CPU处理硬中断的时间占比(单位:%) +cpu_usage_softirq: CPU处理软中断的时间占比(单位:%) +cpu_usage_steal: 在虚拟机环境下有该指标,表示CPU被其他虚拟机争用的时间占比,超过20就表示争抢严重(单位:%) +cpu_usage_guest: 通过虚拟化运行其他操作系统的时间,也就是运行虚拟机的CPU时间占比(单位:%) +cpu_usage_guest_nice: 以低优先级运行虚拟机的时间占比(单位:%) + +disk_free: 硬盘分区剩余量(单位:byte) +disk_used: 硬盘分区使用量(单位:byte) +disk_used_percent: 硬盘分区使用率(单位:%) +disk_total: 硬盘分区总量(单位:byte) +disk_inodes_free: 硬盘分区inode剩余量 +disk_inodes_used: 硬盘分区inode使用量 +disk_inodes_total: 硬盘分区inode总量 + +diskio_io_time: 从设备视角来看I/O请求总时间,队列中有I/O请求就计数(单位:毫秒),counter类型,需要用函数求rate才有使用价值 +diskio_iops_in_progress: 已经分配给设备驱动且尚未完成的IO请求,不包含在队列中但尚未分配给设备驱动的IO请求,gauge类型 +diskio_merged_reads: 相邻读请求merge读的次数,counter类型 +diskio_merged_writes: 相邻写请求merge写的次数,counter类型 +diskio_read_bytes: 读取的byte数量,counter类型,需要用函数求rate才有使用价值 +diskio_read_time: 读请求总时间(单位:毫秒),counter类型,需要用函数求rate才有使用价值 +diskio_reads: 读请求次数,counter类型,需要用函数求rate才有使用价值 +diskio_weighted_io_time: 从I/O请求视角来看I/O等待总时间,如果同时有多个I/O请求,时间会叠加(单位:毫秒) +diskio_write_bytes: 写入的byte数量,counter类型,需要用函数求rate才有使用价值 +diskio_write_time: 写请求总时间(单位:毫秒),counter类型,需要用函数求rate才有使用价值 +diskio_writes: 写请求次数,counter类型,需要用函数求rate才有使用价值 + +kernel_boot_time: 内核启动时间 +kernel_context_switches: 内核上下文切换次数 +kernel_entropy_avail: linux系统内部的熵池 +kernel_interrupts: 内核中断次数 +kernel_processes_forked: fork的进程数 + +mem_active: 活跃使用的内存总数(包括cache和buffer内存) +mem_available: 应用程序可用内存数 +mem_available_percent: 内存剩余百分比(0~100) +mem_buffered: 用来给文件做缓冲大小 +mem_cached: 被高速缓冲存储器(cache memory)用的内存的大小(等于 diskcache minus SwapCache ) +mem_commit_limit: 根据超额分配比率('vm.overcommit_ratio'),这是当前在系统上分配可用的内存总量,这个限制只是在模式2('vm.overcommit_memory')时启用 +mem_committed_as: 目前在系统上分配的内存量。是所有进程申请的内存的总和 +mem_dirty: 等待被写回到磁盘的内存大小 +mem_free: 空闲内存数 +mem_high_free: 未被使用的高位内存大小 +mem_high_total: 高位内存总大小(Highmem是指所有内存高于860MB的物理内存,Highmem区域供用户程序使用,或用于页面缓存。该区域不是直接映射到内核空间。内核必须使用不同的手法使用该段内存) +mem_huge_page_size: 每个大页的大小 +mem_huge_pages_free: 池中尚未分配的 HugePages 数量 +mem_huge_pages_total: 预留HugePages的总个数 +mem_inactive: 空闲的内存数(包括free和avalible的内存) +mem_low_free: 未被使用的低位大小 +mem_low_total: 低位内存总大小,低位可以达到高位内存一样的作用,而且它还能够被内核用来记录一些自己的数据结构 +mem_mapped: 设备和文件等映射的大小 +mem_page_tables: 管理内存分页页面的索引表的大小 +mem_shared: 多个进程共享的内存总额 +mem_slab: 内核数据结构缓存的大小,可以减少申请和释放内存带来的消耗 +mem_sreclaimable: 可收回Slab的大小 +mem_sunreclaim: 不可收回Slab的大小(SUnreclaim+SReclaimable=Slab) +mem_swap_cached: 被高速缓冲存储器(cache memory)用的交换空间的大小,已经被交换出来的内存,但仍然被存放在swapfile中。用来在需要的时候很快的被替换而不需要再次打开I/O端口 +mem_swap_free: 未被使用交换空间的大小 +mem_swap_total: 交换空间的总大小 +mem_total: 内存总数 +mem_used: 已用内存数 +mem_used_percent: 已用内存数百分比(0~100) +mem_vmalloc_chunk: 最大的连续未被使用的vmalloc区域 +mem_vmalloc_totalL: 可以vmalloc虚拟内存大小 +mem_vmalloc_used: vmalloc已使用的虚拟内存大小 +mem_write_back: 正在被写回到磁盘的内存大小 +mem_write_back_tmp: FUSE用于临时写回缓冲区的内存 + +net_bytes_recv: 网卡收包总数(bytes) +net_bytes_sent: 网卡发包总数(bytes) +net_drop_in: 网卡收丢包数量 +net_drop_out: 网卡发丢包数量 +net_err_in: 网卡收包错误数量 +net_err_out: 网卡发包错误数量 +net_packets_recv: 网卡收包数量 +net_packets_sent: 网卡发包数量 + +netstat_tcp_established: ESTABLISHED状态的网络链接数 +netstat_tcp_fin_wait1: FIN_WAIT1状态的网络链接数 +netstat_tcp_fin_wait2: FIN_WAIT2状态的网络链接数 +netstat_tcp_last_ack: LAST_ACK状态的网络链接数 +netstat_tcp_listen: LISTEN状态的网络链接数 +netstat_tcp_syn_recv: SYN_RECV状态的网络链接数 +netstat_tcp_syn_sent: SYN_SENT状态的网络链接数 +netstat_tcp_time_wait: TIME_WAIT状态的网络链接数 +netstat_udp_socket: UDP状态的网络链接数 + +processes_blocked: 不可中断的睡眠状态下的进程数('U','D','L') +processes_dead: 回收中的进程数('X') +processes_idle: 挂起的空闲进程数('I') +processes_paging: 分页进程数('P') +processes_running: 运行中的进程数('R') +processes_sleeping: 可中断进程数('S') +processes_stopped: 暂停状态进程数('T') +processes_total: 总进程数 +processes_total_threads: 总线程数 +processes_unknown: 未知状态进程数 +processes_zombies: 僵尸态进程数('Z') + +swap_used_percent: Swap空间换出数据量 + +system_load1: 1分钟平均load值 +system_load5: 5分钟平均load值 +system_load15: 15分钟平均load值 +system_n_users: 用户数 +system_n_cpus: CPU核数 +system_uptime: 系统启动时间 + +nginx_accepts: 自nginx启动起,与客户端建立过得连接总数 +nginx_active: 当前nginx正在处理的活动连接数,等于Reading/Writing/Waiting总和 +nginx_handled: 自nginx启动起,处理过的客户端连接总数 +nginx_reading: 正在读取HTTP请求头部的连接总数 +nginx_requests: 自nginx启动起,处理过的客户端请求总数,由于存在HTTP Krrp-Alive请求,该值会大于handled值 +nginx_upstream_check_fall: upstream_check模块检测到后端失败的次数 +nginx_upstream_check_rise: upstream_check模块对后端的检测次数 +nginx_upstream_check_status_code: 后端upstream的状态,up为1,down为0 +nginx_waiting: 开启 keep-alive 的情况下,这个值等于 active – (reading+writing), 意思就是 Nginx 已经处理完正在等候下一次请求指令的驻留连接 +nginx_writing: 正在向客户端发送响应的连接总数 + +http_response_content_length: HTTP消息实体的传输长度 +http_response_http_response_code: http响应状态码 +http_response_response_time: http响应用时 +http_response_result_code: url探测结果0为正常否则url无法访问 + +# [mysqld_exporter] +mysql_global_status_uptime: The number of seconds that the server has been up.(Gauge) +mysql_global_status_uptime_since_flush_status: The number of seconds since the most recent FLUSH STATUS statement.(Gauge) +mysql_global_status_queries: The number of statements executed by the server. This variable includes statements executed within stored programs, unlike the Questions variable. It does not count COM_PING or COM_STATISTICS commands.(Counter) +mysql_global_status_threads_connected: The number of currently open connections.(Counter) +mysql_global_status_connections: The number of connection attempts (successful or not) to the MySQL server.(Gauge) +mysql_global_status_max_used_connections: The maximum number of connections that have been in use simultaneously since the server started.(Gauge) +mysql_global_status_threads_running: The number of threads that are not sleeping.(Gauge) +mysql_global_status_questions: The number of statements executed by the server. This includes only statements sent to the server by clients and not statements executed within stored programs, unlike the Queries variable. This variable does not count COM_PING, COM_STATISTICS, COM_STMT_PREPARE, COM_STMT_CLOSE, or COM_STMT_RESET commands.(Counter) +mysql_global_status_threads_cached: The number of threads in the thread cache.(Counter) +mysql_global_status_threads_created: The number of threads created to handle connections. If Threads_created is big, you may want to increase the thread_cache_size value. The cache miss rate can be calculated as Threads_created/Connections.(Counter) +mysql_global_status_created_tmp_tables: The number of internal temporary tables created by the server while executing statements.(Counter) +mysql_global_status_created_tmp_disk_tables: The number of internal on-disk temporary tables created by the server while executing statements. You can compare the number of internal on-disk temporary tables created to the total number of internal temporary tables created by comparing Created_tmp_disk_tables and Created_tmp_tables values.(Counter) +mysql_global_status_created_tmp_files: How many temporary files mysqld has created.(Counter) +mysql_global_status_select_full_join: The number of joins that perform table scans because they do not use indexes. If this value is not 0, you should carefully check the indexes of your tables.(Counter) +mysql_global_status_select_full_range_join: The number of joins that used a range search on a reference table.(Counter) +mysql_global_status_select_range: The number of joins that used ranges on the first table. This is normally not a critical issue even if the value is quite large.(Counter) +mysql_global_status_select_range_check: The number of joins without keys that check for key usage after each row. If this is not 0, you should carefully check the indexes of your tables.(Counter) +mysql_global_status_select_scan: The number of joins that did a full scan of the first table.(Counter) +mysql_global_status_sort_rows: The number of sorted rows.(Counter) +mysql_global_status_sort_range: The number of sorts that were done using ranges.(Counter) +mysql_global_status_sort_merge_passes: The number of merge passes that the sort algorithm has had to do. If this value is large, you should consider increasing the value of the sort_buffer_size system variable.(Counter) +mysql_global_status_sort_scan: The number of sorts that were done by scanning the table.(Counter) +mysql_global_status_slow_queries: The number of queries that have taken more than long_query_time seconds. This counter increments regardless of whether the slow query log is enabled.(Counter) +mysql_global_status_aborted_connects: The number of failed attempts to connect to the MySQL server.(Counter) +mysql_global_status_aborted_clients: The number of connections that were aborted because the client died without closing the connection properly.(Counter) +mysql_global_status_table_locks_immediate: The number of times that a request for a table lock could be granted immediately. Locks Immediate rising and falling is normal activity.(Counter) +mysql_global_status_table_locks_waited: The number of times that a request for a table lock could not be granted immediately and a wait was needed. If this is high and you have performance problems, you should first optimize your queries, and then either split your table or tables or use replication.(Counter) +mysql_global_status_bytes_received: The number of bytes received from all clients.(Counter) +mysql_global_status_bytes_sent: The number of bytes sent to all clients.(Counter) +mysql_global_status_innodb_page_size: InnoDB page size (default 16KB). Many values are counted in pages; the page size enables them to be easily converted to bytes.(Gauge) +mysql_global_status_buffer_pool_pages: The number of pages in the InnoDB buffer pool.(Gauge) +mysql_global_status_commands_total: The number of times each xxx statement has been executed.(Counter) +mysql_global_status_handlers_total: Handler statistics are internal statistics on how MySQL is selecting, updating, inserting, and modifying rows, tables, and indexes. This is in fact the layer between the Storage Engine and MySQL.(Counter) +mysql_global_status_opened_files: The number of files that have been opened with my_open() (a mysys library function). Parts of the server that open files without using this function do not increment the count.(Counter) +mysql_global_status_open_tables: The number of tables that are open.(Gauge) +mysql_global_status_opened_tables: The number of tables that have been opened. If Opened_tables is big, your table_open_cache value is probably too small.(Counter) +mysql_global_status_table_open_cache_hits: The number of hits for open tables cache lookups.(Counter) +mysql_global_status_table_open_cache_misses: The number of misses for open tables cache lookups.(Counter) +mysql_global_status_table_open_cache_overflows: The number of overflows for the open tables cache.(Counter) +mysql_global_status_innodb_num_open_files: The number of files InnoDB currently holds open.(Gauge) +mysql_global_status_connection_errors_total: These variables provide information about errors that occur during the client connection process.(Counter) +mysql_global_status_innodb_buffer_pool_read_requests: The number of logical read requests.(Counter) +mysql_global_status_innodb_buffer_pool_reads: The number of logical reads that InnoDB could not satisfy from the buffer pool, and had to read directly from disk.(Counter) + +mysql_global_variables_thread_cache_size: How many threads the server should cache for reuse.(Gauge) +mysql_global_variables_max_connections: The maximum permitted number of simultaneous client connections.(Gauge) +mysql_global_variables_innodb_buffer_pool_size: The size in bytes of the buffer pool, the memory area where InnoDB caches table and index data. The default value is 134217728 bytes (128MB).(Gauge) +mysql_global_variables_innodb_log_buffer_size: The size in bytes of the buffer that InnoDB uses to write to the log files on disk.(Gauge) +mysql_global_variables_key_buffer_size: Index blocks for MyISAM tables are buffered and are shared by all threads.(Gauge) +mysql_global_variables_query_cache_size: The amount of memory allocated for caching query results.(Gauge) +mysql_global_variables_table_open_cache: The number of open tables for all threads.(Gauge) +mysql_global_variables_open_files_limit: The number of file descriptors available to mysqld from the operating system.(Gauge) + +# [redis_exporter] +redis_active_defrag_running: When activedefrag is enabled, this indicates whether defragmentation is currently active, and the CPU percentage it intends to utilize. +redis_allocator_active_bytes: Total bytes in the allocator active pages, this includes external-fragmentation. +redis_allocator_allocated_bytes: Total bytes allocated form the allocator, including internal-fragmentation. Normally the same as used_memory. +redis_allocator_frag_bytes: Delta between allocator_active and allocator_allocated. See note about mem_fragmentation_bytes. +redis_allocator_frag_ratio: Ratio between allocator_active and allocator_allocated. This is the true (external) fragmentation metric (not mem_fragmentation_ratio). +redis_allocator_resident_bytes: Total bytes resident (RSS) in the allocator, this includes pages that can be released to the OS (by MEMORY PURGE, or just waiting). +redis_allocator_rss_bytes: Delta between allocator_resident and allocator_active. +redis_allocator_rss_ratio: Ratio between allocator_resident and allocator_active. This usually indicates pages that the allocator can and probably will soon release back to the OS. +redis_aof_current_rewrite_duration_sec: Duration of the on-going AOF rewrite operation if any. +redis_aof_enabled: Flag indicating AOF logging is activated. +redis_aof_last_bgrewrite_status: Status of the last AOF rewrite operation. +redis_aof_last_cow_size_bytes: The size in bytes of copy-on-write memory during the last AOF rewrite operation. +redis_aof_last_rewrite_duration_sec: Duration of the last AOF rewrite operation in seconds. +redis_aof_last_write_status: Status of the last write operation to the AOF. +redis_aof_rewrite_in_progress: Flag indicating a AOF rewrite operation is on-going. +redis_aof_rewrite_scheduled: Flag indicating an AOF rewrite operation will be scheduled once the on-going RDB save is complete. +redis_blocked_clients: Number of clients pending on a blocking call (BLPOP, BRPOP, BRPOPLPUSH, BLMOVE, BZPOPMIN, BZPOPMAX). +redis_client_recent_max_input_buffer_bytes: Biggest input buffer among current client connections. +redis_client_recent_max_output_buffer_bytes: Biggest output buffer among current client connections. +redis_cluster_enabled: Indicate Redis cluster is enabled. +redis_commands_duration_seconds_total: The total CPU time consumed by these commands.(Counter) +redis_commands_processed_total: Total number of commands processed by the server.(Counter) +redis_commands_total: The number of calls that reached command execution (not rejected).(Counter) +redis_config_maxclients: The value of the maxclients configuration directive. This is the upper limit for the sum of connected_clients, connected_slaves and cluster_connections. +redis_config_maxmemory: The value of the maxmemory configuration directive. +redis_connected_clients: Number of client connections (excluding connections from replicas). +redis_connected_slaves: Number of connected replicas. +redis_connections_received_total: Total number of connections accepted by the server.(Counter) +redis_cpu_sys_children_seconds_total: System CPU consumed by the background processes.(Counter) +redis_cpu_sys_seconds_total: System CPU consumed by the Redis server, which is the sum of system CPU consumed by all threads of the server process (main thread and background threads).(Counter) +redis_cpu_user_children_seconds_total: User CPU consumed by the background processes.(Counter) +redis_cpu_user_seconds_total: User CPU consumed by the Redis server, which is the sum of user CPU consumed by all threads of the server process (main thread and background threads).(Counter) +redis_db_keys: Total number of keys by DB. +redis_db_keys_expiring: Total number of expiring keys by DB +redis_defrag_hits: Number of value reallocations performed by active the defragmentation process. +redis_defrag_misses: Number of aborted value reallocations started by the active defragmentation process. +redis_defrag_key_hits: Number of keys that were actively defragmented. +redis_defrag_key_misses: Number of keys that were skipped by the active defragmentation process. +redis_evicted_keys_total: Number of evicted keys due to maxmemory limit.(Counter) +redis_expired_keys_total: Total number of key expiration events.(Counter) +redis_expired_stale_percentage: The percentage of keys probably expired. +redis_expired_time_cap_reached_total: The count of times that active expiry cycles have stopped early. +redis_exporter_last_scrape_connect_time_seconds: The duration(in seconds) to connect when scrape. +redis_exporter_last_scrape_duration_seconds: The last scrape duration. +redis_exporter_last_scrape_error: The last scrape error status. +redis_exporter_scrape_duration_seconds_count: Durations of scrapes by the exporter +redis_exporter_scrape_duration_seconds_sum: Durations of scrapes by the exporter +redis_exporter_scrapes_total: Current total redis scrapes.(Counter) +redis_instance_info: Information about the Redis instance. +redis_keyspace_hits_total: Hits total.(Counter) +redis_keyspace_misses_total: Misses total.(Counter) +redis_last_key_groups_scrape_duration_milliseconds: Duration of the last key group metrics scrape in milliseconds. +redis_last_slow_execution_duration_seconds: The amount of time needed for last slow execution, in seconds. +redis_latest_fork_seconds: The amount of time needed for last fork, in seconds. +redis_lazyfree_pending_objects: The number of objects waiting to be freed (as a result of calling UNLINK, or FLUSHDB and FLUSHALL with the ASYNC option). +redis_master_repl_offset: The server's current replication offset. +redis_mem_clients_normal: Memory used by normal clients.(Gauge) +redis_mem_clients_slaves: Memory used by replica clients - Starting Redis 7.0, replica buffers share memory with the replication backlog, so this field can show 0 when replicas don't trigger an increase of memory usage. +redis_mem_fragmentation_bytes: Delta between used_memory_rss and used_memory. Note that when the total fragmentation bytes is low (few megabytes), a high ratio (e.g. 1.5 and above) is not an indication of an issue. +redis_mem_fragmentation_ratio: Ratio between used_memory_rss and used_memory. Note that this doesn't only includes fragmentation, but also other process overheads (see the allocator_* metrics), and also overheads like code, shared libraries, stack, etc. +redis_mem_not_counted_for_eviction_bytes: (Gauge) +redis_memory_max_bytes: Max memory limit in bytes. +redis_memory_used_bytes: Total number of bytes allocated by Redis using its allocator (either standard libc, jemalloc, or an alternative allocator such as tcmalloc) +redis_memory_used_dataset_bytes: The size in bytes of the dataset (used_memory_overhead subtracted from used_memory) +redis_memory_used_lua_bytes: Number of bytes used by the Lua engine. +redis_memory_used_overhead_bytes: The sum in bytes of all overheads that the server allocated for managing its internal data structures. +redis_memory_used_peak_bytes: Peak memory consumed by Redis (in bytes) +redis_memory_used_rss_bytes: Number of bytes that Redis allocated as seen by the operating system (a.k.a resident set size). This is the number reported by tools such as top(1) and ps(1) +redis_memory_used_scripts_bytes: Number of bytes used by cached Lua scripts +redis_memory_used_startup_bytes: Initial amount of memory consumed by Redis at startup in bytes +redis_migrate_cached_sockets_total: The number of sockets open for MIGRATE purposes +redis_net_input_bytes_total: Total input bytes(Counter) +redis_net_output_bytes_total: Total output bytes(Counter) +redis_process_id: Process ID +redis_pubsub_channels: Global number of pub/sub channels with client subscriptions +redis_pubsub_patterns: Global number of pub/sub pattern with client subscriptions +redis_rdb_bgsave_in_progress: Flag indicating a RDB save is on-going +redis_rdb_changes_since_last_save: Number of changes since the last dump +redis_rdb_current_bgsave_duration_sec: Duration of the on-going RDB save operation if any +redis_rdb_last_bgsave_duration_sec: Duration of the last RDB save operation in seconds +redis_rdb_last_bgsave_status: Status of the last RDB save operation +redis_rdb_last_cow_size_bytes: The size in bytes of copy-on-write memory during the last RDB save operation +redis_rdb_last_save_timestamp_seconds: Epoch-based timestamp of last successful RDB save +redis_rejected_connections_total: Number of connections rejected because of maxclients limit(Counter) +redis_repl_backlog_first_byte_offset: The master offset of the replication backlog buffer +redis_repl_backlog_history_bytes: Size in bytes of the data in the replication backlog buffer +redis_repl_backlog_is_active: Flag indicating replication backlog is active +redis_replica_partial_resync_accepted: The number of accepted partial resync requests(Gauge) +redis_replica_partial_resync_denied: The number of denied partial resync requests(Gauge) +redis_replica_resyncs_full: The number of full resyncs with replicas +redis_replication_backlog_bytes: Memory used by replication backlog +redis_second_repl_offset: The offset up to which replication IDs are accepted. +redis_slave_expires_tracked_keys: The number of keys tracked for expiry purposes (applicable only to writable replicas)(Gauge) +redis_slowlog_last_id: Last id of slowlog +redis_slowlog_length: Total slowlog +redis_start_time_seconds: Start time of the Redis instance since unix epoch in seconds. +redis_target_scrape_request_errors_total: Errors in requests to the exporter +redis_up: Flag indicating redis instance is up +redis_uptime_in_seconds: Number of seconds since Redis server start + +# [windows_exporter] +windows_cpu_clock_interrupts_total: Total number of received and serviced clock tick interrupts(counter) +windows_cpu_core_frequency_mhz: Core frequency in megahertz(gauge) +windows_cpu_cstate_seconds_total: Time spent in low-power idle state(counter) +windows_cpu_dpcs_total: Total number of received and serviced deferred procedure calls (DPCs)(counter) +windows_cpu_idle_break_events_total: Total number of time processor was woken from idle(counter) +windows_cpu_interrupts_total: Total number of received and serviced hardware interrupts(counter) +windows_cpu_parking_status: Parking Status represents whether a processor is parked or not(gauge) +windows_cpu_processor_performance: Processor Performance is the average performance of the processor while it is executing instructions, as a percentage of the nominal performance of the processor. On some processors, Processor Performance may exceed 100%(gauge) +windows_cpu_time_total: Time that processor spent in different modes (idle, user, system, ...)(counter) +windows_cs_hostname: Labeled system hostname information as provided by ComputerSystem.DNSHostName and ComputerSystem.Domain(gauge) +windows_cs_logical_processors: ComputerSystem.NumberOfLogicalProcessors(gauge) +windows_cs_physical_memory_bytes: ComputerSystem.TotalPhysicalMemory(gauge) +windows_exporter_build_info: A metric with a constant '1' value labeled by version, revision, branch, and goversion from which windows_exporter was built.(gauge) +windows_exporter_collector_duration_seconds: Duration of a collection.(gauge) +windows_exporter_collector_success: Whether the collector was successful.(gauge) +windows_exporter_collector_timeout: Whether the collector timed out.(gauge) +windows_exporter_perflib_snapshot_duration_seconds: Duration of perflib snapshot capture(gauge) +windows_logical_disk_free_bytes: Free space in bytes (LogicalDisk.PercentFreeSpace)(gauge) +windows_logical_disk_idle_seconds_total: Seconds that the disk was idle (LogicalDisk.PercentIdleTime)(counter) +windows_logical_disk_read_bytes_total: The number of bytes transferred from the disk during read operations (LogicalDisk.DiskReadBytesPerSec)(counter) +windows_logical_disk_read_latency_seconds_total: Shows the average time, in seconds, of a read operation from the disk (LogicalDisk.AvgDiskSecPerRead)(counter) +windows_logical_disk_read_seconds_total: Seconds that the disk was busy servicing read requests (LogicalDisk.PercentDiskReadTime)(counter) +windows_logical_disk_read_write_latency_seconds_total: Shows the time, in seconds, of the average disk transfer (LogicalDisk.AvgDiskSecPerTransfer)(counter) +windows_logical_disk_reads_total: The number of read operations on the disk (LogicalDisk.DiskReadsPerSec)(counter) +windows_logical_disk_requests_queued: The number of requests queued to the disk (LogicalDisk.CurrentDiskQueueLength)(gauge) +windows_logical_disk_size_bytes: Total space in bytes (LogicalDisk.PercentFreeSpace_Base)(gauge) +windows_logical_disk_split_ios_total: The number of I/Os to the disk were split into multiple I/Os (LogicalDisk.SplitIOPerSec)(counter) +windows_logical_disk_write_bytes_total: The number of bytes transferred to the disk during write operations (LogicalDisk.DiskWriteBytesPerSec)(counter) +windows_logical_disk_write_latency_seconds_total: Shows the average time, in seconds, of a write operation to the disk (LogicalDisk.AvgDiskSecPerWrite)(counter) +windows_logical_disk_write_seconds_total: Seconds that the disk was busy servicing write requests (LogicalDisk.PercentDiskWriteTime)(counter) +windows_logical_disk_writes_total: The number of write operations on the disk (LogicalDisk.DiskWritesPerSec)(counter) +windows_net_bytes_received_total: (Network.BytesReceivedPerSec)(counter) +windows_net_bytes_sent_total: (Network.BytesSentPerSec)(counter) +windows_net_bytes_total: (Network.BytesTotalPerSec)(counter) +windows_net_current_bandwidth: (Network.CurrentBandwidth)(gauge) +windows_net_packets_outbound_discarded_total: (Network.PacketsOutboundDiscarded)(counter) +windows_net_packets_outbound_errors_total: (Network.PacketsOutboundErrors)(counter) +windows_net_packets_received_discarded_total: (Network.PacketsReceivedDiscarded)(counter) +windows_net_packets_received_errors_total: (Network.PacketsReceivedErrors)(counter) +windows_net_packets_received_total: (Network.PacketsReceivedPerSec)(counter) +windows_net_packets_received_unknown_total: (Network.PacketsReceivedUnknown)(counter) +windows_net_packets_sent_total: (Network.PacketsSentPerSec)(counter) +windows_net_packets_total: (Network.PacketsPerSec)(counter) +windows_os_info: OperatingSystem.Caption, OperatingSystem.Version(gauge) +windows_os_paging_free_bytes: OperatingSystem.FreeSpaceInPagingFiles(gauge) +windows_os_paging_limit_bytes: OperatingSystem.SizeStoredInPagingFiles(gauge) +windows_os_physical_memory_free_bytes: OperatingSystem.FreePhysicalMemory(gauge) +windows_os_process_memory_limix_bytes: OperatingSystem.MaxProcessMemorySize(gauge) +windows_os_processes: OperatingSystem.NumberOfProcesses(gauge) +windows_os_processes_limit: OperatingSystem.MaxNumberOfProcesses(gauge) +windows_os_time: OperatingSystem.LocalDateTime(gauge) +windows_os_timezone: OperatingSystem.LocalDateTime(gauge) +windows_os_users: OperatingSystem.NumberOfUsers(gauge) +windows_os_virtual_memory_bytes: OperatingSystem.TotalVirtualMemorySize(gauge) +windows_os_virtual_memory_free_bytes: OperatingSystem.FreeVirtualMemory(gauge) +windows_os_visible_memory_bytes: OperatingSystem.TotalVisibleMemorySize(gauge) +windows_service_info: A metric with a constant '1' value labeled with service information(gauge) +windows_service_start_mode: The start mode of the service (StartMode)(gauge) +windows_service_state: The state of the service (State)(gauge) +windows_service_status: The status of the service (Status)(gauge) +windows_system_context_switches_total: Total number of context switches (WMI source is PerfOS_System.ContextSwitchesPersec)(counter) +windows_system_exception_dispatches_total: Total number of exceptions dispatched (WMI source is PerfOS_System.ExceptionDispatchesPersec)(counter) +windows_system_processor_queue_length: Length of processor queue (WMI source is PerfOS_System.ProcessorQueueLength)(gauge) +windows_system_system_calls_total: Total number of system calls (WMI source is PerfOS_System.SystemCallsPersec)(counter) +windows_system_system_up_time: System boot time (WMI source is PerfOS_System.SystemUpTime)(gauge) +windows_system_threads: Current number of threads (WMI source is PerfOS_System.Threads)(gauge) + +# [node_exporter] +# SYSTEM +# CPU context switch 次数 +node_context_switches_total: context_switches +# Interrupts 次数 +node_intr_total: Interrupts +# 运行的进程数 +node_procs_running: Processes in runnable state +# 熵池大小 +node_entropy_available_bits: Entropy available to random number generators +node_time_seconds: System time in seconds since epoch (1970) +node_boot_time_seconds: Node boot time, in unixtime +# CPU +node_cpu_seconds_total: Seconds the CPUs spent in each mode +node_load1: cpu load 1m +node_load5: cpu load 5m +node_load15: cpu load 15m + +# MEM +# 内核态 +# 用户追踪已从交换区获取但尚未修改的页面的内存 +node_memory_SwapCached_bytes: Memory that keeps track of pages that have been fetched from swap but not yet been modified +# 内核用于缓存数据结构供自己使用的内存 +node_memory_Slab_bytes: Memory used by the kernel to cache data structures for its own use +# slab中可回收的部分 +node_memory_SReclaimable_bytes: SReclaimable - Part of Slab, that might be reclaimed, such as caches +# slab中不可回收的部分 +node_memory_SUnreclaim_bytes: Part of Slab, that cannot be reclaimed on memory pressure +# Vmalloc内存区的大小 +node_memory_VmallocTotal_bytes: Total size of vmalloc memory area +# vmalloc已分配的内存,虚拟地址空间上的连续的内存 +node_memory_VmallocUsed_bytes: Amount of vmalloc area which is used +# vmalloc区可用的连续最大快的大小,通过此指标可以知道vmalloc可分配连续内存的最大值 +node_memory_VmallocChunk_bytes: Largest contigious block of vmalloc area which is free +# 内存的硬件故障删除掉的内存页的总大小 +node_memory_HardwareCorrupted_bytes: Amount of RAM that the kernel identified as corrupted / not working +# 用于在虚拟和物理内存地址之间映射的内存 +node_memory_PageTables_bytes: Memory used to map between virtual and physical memory addresses (gauge) +# 内核栈内存,常驻内存,不可回收 +node_memory_KernelStack_bytes: Kernel memory stack. This is not reclaimable +# 用来访问高端内存,复制高端内存的临时buffer,称为“bounce buffering”,会降低I/O 性能 +node_memory_Bounce_bytes: Memory used for block device bounce buffers +#用户态 +# 单个巨页大小 +node_memory_Hugepagesize_bytes: Huge Page size +# 系统分配的常驻巨页数 +node_memory_HugePages_Total: Total size of the pool of huge pages +# 系统空闲的巨页数 +node_memory_HugePages_Free: Huge pages in the pool that are not yet allocated +# 进程已申请但未使用的巨页数 +node_memory_HugePages_Rsvd: Huge pages for which a commitment to allocate from the pool has been made, but no allocation +# 超过系统设定的常驻HugePages数量的个数 +node_memory_HugePages_Surp: Huge pages in the pool above the value in /proc/sys/vm/nr_hugepages +# 透明巨页 Transparent HugePages (THP) +node_memory_AnonHugePages_bytes: Memory in anonymous huge pages +# inactivelist中的File-backed内存 +node_memory_Inactive_file_bytes: File-backed memory on inactive LRU list +# inactivelist中的Anonymous内存 +node_memory_Inactive_anon_bytes: Anonymous and swap cache on inactive LRU list, including tmpfs (shmem) +# activelist中的File-backed内存 +node_memory_Active_file_bytes: File-backed memory on active LRU list +# activelist中的Anonymous内存 +node_memory_Active_anon_bytes: Anonymous and swap cache on active least-recently-used (LRU) list, including tmpfs +# 禁止换出的页,对应 Unevictable 链表 +node_memory_Unevictable_bytes: Amount of unevictable memory that can't be swapped out for a variety of reasons +# 共享内存 +node_memory_Shmem_bytes: Used shared memory (shared between several processes, thus including RAM disks) +# 匿名页内存大小 +node_memory_AnonPages_bytes: Memory in user pages not backed by files +# 被关联的内存页大小 +node_memory_Mapped_bytes: Used memory in mapped pages files which have been mmaped, such as libraries +# file-backed内存页缓存大小 +node_memory_Cached_bytes: Parked file data (file content) cache +# 系统中有多少匿名页曾经被swap-out、现在又被swap-in并且swap-in之后页面中的内容一直没发生变化 +node_memory_SwapCached_bytes: Memory that keeps track of pages that have been fetched from swap but not yet been modified +# 被mlock()系统调用锁定的内存大小 +node_memory_Mlocked_bytes: Size of pages locked to memory using the mlock() system call +# 块设备(block device)所占用的缓存页 +node_memory_Buffers_bytes: Block device (e.g. harddisk) cache +node_memory_SwapTotal_bytes: Memory information field SwapTotal_bytes +node_memory_SwapFree_bytes: Memory information field SwapFree_bytes + +# DISK +node_filesystem_files_free: Filesystem space available to non-root users in byte +node_filesystem_free_bytes: Filesystem free space in bytes +node_filesystem_size_bytes: Filesystem size in bytes +node_filesystem_files_free: Filesystem total free file nodes +node_filesystem_files: Filesystem total free file nodes +node_filefd_maximum: Max open files +node_filefd_allocated: Open files +node_filesystem_readonly: Filesystem read-only status +node_filesystem_device_error: Whether an error occurred while getting statistics for the given device +node_disk_reads_completed_total: The total number of reads completed successfully +node_disk_writes_completed_total: The total number of writes completed successfully +node_disk_reads_merged_total: The number of reads merged +node_disk_writes_merged_total: The number of writes merged +node_disk_read_bytes_total: The total number of bytes read successfully +node_disk_written_bytes_total: The total number of bytes written successfully +node_disk_io_time_seconds_total: Total seconds spent doing I/Os +node_disk_read_time_seconds_total: The total number of seconds spent by all reads +node_disk_write_time_seconds_total: The total number of seconds spent by all writes +node_disk_io_time_weighted_seconds_total: The weighted of seconds spent doing I/Os + +# NET +node_network_receive_bytes_total: Network device statistic receive_bytes (counter) +node_network_transmit_bytes_total: Network device statistic transmit_bytes (counter) +node_network_receive_packets_total: Network device statistic receive_bytes +node_network_transmit_packets_total: Network device statistic transmit_bytes +node_network_receive_errs_total: Network device statistic receive_errs +node_network_transmit_errs_total: Network device statistic transmit_errs +node_network_receive_drop_total: Network device statistic receive_drop +node_network_transmit_drop_total: Network device statistic transmit_drop +node_nf_conntrack_entries: Number of currently allocated flow entries for connection tracking +node_sockstat_TCP_alloc: Number of TCP sockets in state alloc +node_sockstat_TCP_inuse: Number of TCP sockets in state inuse +node_sockstat_TCP_orphan: Number of TCP sockets in state orphan +node_sockstat_TCP_tw: Number of TCP sockets in state tw +node_netstat_Tcp_CurrEstab: Statistic TcpCurrEstab +node_sockstat_sockets_used: Number of IPv4 sockets in use + +# [kafka_exporter] +kafka_brokers: count of kafka_brokers (gauge) +kafka_topic_partitions: Number of partitions for this Topic (gauge) +kafka_topic_partition_current_offset: Current Offset of a Broker at Topic/Partition (gauge) +kafka_consumergroup_current_offset: Current Offset of a ConsumerGroup at Topic/Partition (gauge) +kafka_consumer_lag_millis: Current approximation of consumer lag for a ConsumerGroup at Topic/Partition (gauge) +kafka_topic_partition_under_replicated_partition: 1 if Topic/Partition is under Replicated + +# [zookeeper_exporter] +zk_znode_count: The total count of znodes stored +zk_ephemerals_count: The number of Ephemerals nodes +zk_watch_count: The number of watchers setup over Zookeeper nodes. +zk_approximate_data_size: Size of data in bytes that a zookeeper server has in its data tree +zk_outstanding_requests: Number of currently executing requests +zk_packets_sent: Count of the number of zookeeper packets sent from a server +zk_packets_received: Count of the number of zookeeper packets received by a server +zk_num_alive_connections: Number of active clients connected to a zookeeper server +zk_open_file_descriptor_count: Number of file descriptors that a zookeeper server has open +zk_max_file_descriptor_count: Maximum number of file descriptors that a zookeeper server can open +zk_avg_latency: Average time in milliseconds for requests to be processed +zk_min_latency: Maximum time in milliseconds for a request to be processed +zk_max_latency: Minimum time in milliseconds for a request to be processed \ No newline at end of file diff --git a/n9e/initsql/a-n9e.sql b/n9e/initsql/a-n9e.sql index d9f9f2a..97340bf 100644 --- a/n9e/initsql/a-n9e.sql +++ b/n9e/initsql/a-n9e.sql @@ -107,12 +107,6 @@ insert into `role_operation`(role_name, operation) values('Standard', '/help/mig insert into `role_operation`(role_name, operation) values('Standard', '/alert-rules-built-in'); insert into `role_operation`(role_name, operation) values('Standard', '/dashboards-built-in'); insert into `role_operation`(role_name, operation) values('Standard', '/trace/dependencies'); - -insert into `role_operation`(role_name, operation) values('Admin', '/help/source'); -insert into `role_operation`(role_name, operation) values('Admin', '/help/sso'); -insert into `role_operation`(role_name, operation) values('Admin', '/help/notification-tpls'); -insert into `role_operation`(role_name, operation) values('Admin', '/help/notification-settings'); - insert into `role_operation`(role_name, operation) values('Standard', '/users'); insert into `role_operation`(role_name, operation) values('Standard', '/user-groups'); insert into `role_operation`(role_name, operation) values('Standard', '/user-groups/add'); @@ -291,6 +285,8 @@ CREATE TABLE `alert_rule` ( `append_tags` varchar(255) not null default '' comment 'split by space: service=n9e mod=api', `annotations` text not null comment 'annotations', `extra_config` text, + `notify_rule_ids` varchar(1024) DEFAULT '', + `notify_version` int DEFAULT 0, `create_at` bigint not null default 0, `create_by` varchar(64) not null default '', `update_at` bigint not null default 0, @@ -351,6 +347,8 @@ CREATE TABLE `alert_subscribe` ( `extra_config` text, `redefine_webhooks` tinyint(1) default 0, `for_duration` bigint not null default 0, + `notify_rule_ids` varchar(1024) DEFAULT '', + `notify_version` int DEFAULT 0, `create_at` bigint not null default 0, `create_by` varchar(64) not null default '', `update_at` bigint not null default 0, @@ -467,6 +465,7 @@ CREATE TABLE `alert_cur_event` ( `rule_config` text not null comment 'annotations', `tags` varchar(1024) not null default '' comment 'merge data_tags rule_tags, split by ,,', `original_tags` text comment 'labels key=val,,k2=v2', + `notify_rule_ids` text COMMENT 'notify rule ids', PRIMARY KEY (`id`), KEY (`hash`), KEY (`rule_id`), @@ -509,6 +508,7 @@ CREATE TABLE `alert_his_event` ( `original_tags` text comment 'labels key=val,,k2=v2', `annotations` text not null comment 'annotations', `rule_config` text not null comment 'annotations', + `notify_rule_ids` text COMMENT 'notify rule ids', PRIMARY KEY (`id`), INDEX `idx_last_eval_time` (`last_eval_time`), KEY (`hash`), @@ -533,10 +533,9 @@ CREATE TABLE `builtin_components` ( `updated_by` varchar(191) NOT NULL DEFAULT '' COMMENT '''updater''', `disabled` int NOT NULL DEFAULT 0 COMMENT '''is disabled or not''', PRIMARY KEY (`id`), - UNIQUE KEY `idx_ident` (`ident`) USING BTREE + KEY (`ident`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; - CREATE TABLE `builtin_payloads` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '''unique identifier''', `component_id` bigint NOT NULL DEFAULT 0 COMMENT '''component_id of payload''', @@ -561,6 +560,7 @@ CREATE TABLE `builtin_payloads` ( CREATE TABLE notification_record ( `id` BIGINT PRIMARY KEY AUTO_INCREMENT, + `notify_rule_id` BIGINT NOT NULL DEFAULT 0, `event_id` bigint NOT NULL COMMENT 'event history id', `sub_id` bigint COMMENT 'subscribed rule id', `channel` varchar(255) NOT NULL COMMENT 'notification channel name', @@ -632,13 +632,16 @@ CREATE TABLE `alerting_engines` `datasource_id` bigint not null default 0 comment 'datasource id', `engine_cluster` varchar(128) not null default '' comment 'n9e-alert cluster', `clock` bigint not null, - PRIMARY KEY (`id`) + PRIMARY KEY (`id`), + INDEX `idx_inst` (`instance`), + INDEX `idx_clock` (`clock`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4; CREATE TABLE `datasource` ( `id` int unsigned NOT NULL AUTO_INCREMENT, `name` varchar(191) not null default '', + `identifier` varchar(255) not null default '', `description` varchar(255) not null default '', `category` varchar(255) not null default '', `plugin_id` int unsigned not null default 0, @@ -695,6 +698,7 @@ CREATE TABLE `es_index_pattern` ( `allow_hide_system_indices` tinyint(1) not null default 0, `fields_format` varchar(4096) not null default '', `cross_cluster_enabled` int not null default 0, + `note` varchar(1024) not null default '', `create_at` bigint default '0', `create_by` varchar(64) default '', `update_at` bigint default '0', @@ -703,6 +707,7 @@ CREATE TABLE `es_index_pattern` ( UNIQUE KEY (`datasource_id`, `name`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4; + CREATE TABLE `builtin_metrics` ( `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'unique identifier', `collector` varchar(191) NOT NULL COMMENT '''type of collector''', @@ -718,7 +723,7 @@ CREATE TABLE `builtin_metrics` ( `updated_by` varchar(191) NOT NULL DEFAULT '' COMMENT '''updater''', `uuid` bigint NOT NULL DEFAULT 0 COMMENT '''uuid''', PRIMARY KEY (`id`), - UNIQUE KEY `idx_collector_typ_name` (`lang`,`collector`, `typ`, `name`), + INDEX `idx_uuid` (`uuid`), INDEX `idx_collector` (`collector`), INDEX `idx_typ` (`typ`), INDEX `idx_builtinmetric_name` (`name` ASC), @@ -765,6 +770,94 @@ CREATE TABLE `dash_annotation` ( KEY `idx_dashboard_id` (`dashboard_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +CREATE TABLE `user_token` ( + `id` bigint NOT NULL AUTO_INCREMENT, + `username` varchar(255) NOT NULL DEFAULT '', + `token_name` varchar(255) NOT NULL DEFAULT '', + `token` varchar(255) NOT NULL DEFAULT '', + `create_at` bigint NOT NULL DEFAULT 0, + `last_used` bigint NOT NULL DEFAULT 0, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + + +CREATE TABLE `notify_rule` ( + `id` bigint unsigned not null auto_increment, + `name` varchar(255) not null, + `description` text, + `enable` tinyint(1) not null default 0, + `user_group_ids` varchar(255) not null default '', + `notify_configs` text, + `pipeline_configs` text, + `create_at` bigint not null default 0, + `create_by` varchar(64) not null default '', + `update_at` bigint not null default 0, + `update_by` varchar(64) not null default '', + PRIMARY KEY (`id`) +) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4; + +CREATE TABLE `notify_channel` ( + `id` bigint unsigned not null auto_increment, + `name` varchar(255) not null, + `ident` varchar(255) not null, + `description` text, + `enable` tinyint(1) not null default 0, + `param_config` text, + `request_type` varchar(50) not null, + `request_config` text, + `weight` int not null default 0, + `create_at` bigint not null default 0, + `create_by` varchar(64) not null default '', + `update_at` bigint not null default 0, + `update_by` varchar(64) not null default '', + PRIMARY KEY (`id`) +) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4; + +CREATE TABLE `message_template` ( + `id` bigint unsigned not null auto_increment, + `name` varchar(64) not null, + `ident` varchar(64) not null, + `content` text, + `user_group_ids` varchar(64), + `notify_channel_ident` varchar(64) not null default '', + `private` int not null default 0, + `weight` int not null default 0, + `create_at` bigint not null default 0, + `create_by` varchar(64) not null default '', + `update_at` bigint not null default 0, + `update_by` varchar(64) not null default '', + PRIMARY KEY (`id`) +) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4; + +CREATE TABLE `event_pipeline` ( + `id` bigint unsigned not null auto_increment, + `name` varchar(128) not null, + `team_ids` text, + `description` varchar(255) not null default '', + `filter_enable` tinyint(1) not null default 0, + `label_filters` text, + `attr_filters` text, + `processor_configs` text, + `create_at` bigint not null default 0, + `create_by` varchar(64) not null default '', + `update_at` bigint not null default 0, + `update_by` varchar(64) not null default '', + PRIMARY KEY (`id`) +) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4; + +CREATE TABLE `embedded_product` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(255) DEFAULT NULL, + `url` varchar(255) DEFAULT NULL, + `is_private` boolean DEFAULT NULL, + `team_ids` varchar(255), + `create_at` bigint not null default 0, + `create_by` varchar(64) not null default '', + `update_at` bigint not null default 0, + `update_by` varchar(64) not null default '', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + CREATE TABLE `task_meta` ( `id` bigint unsigned NOT NULL AUTO_INCREMENT, @@ -2121,4 +2214,16 @@ CREATE TABLE task_host_99 UNIQUE KEY `idx_id_host` (`id`, `host`), PRIMARY KEY (`ii`) ) ENGINE = InnoDB - DEFAULT CHARSET = utf8mb4; \ No newline at end of file + DEFAULT CHARSET = utf8mb4; + +CREATE TABLE `source_token` ( + `id` bigint unsigned NOT NULL AUTO_INCREMENT, + `source_type` varchar(64) NOT NULL DEFAULT '' COMMENT 'source type', + `source_id` varchar(255) NOT NULL DEFAULT '' COMMENT 'source identifier', + `token` varchar(255) NOT NULL DEFAULT '' COMMENT 'access token', + `expire_at` bigint NOT NULL DEFAULT 0 COMMENT 'expire timestamp', + `create_at` bigint NOT NULL DEFAULT 0 COMMENT 'create timestamp', + `create_by` varchar(64) NOT NULL DEFAULT '' COMMENT 'creator', + PRIMARY KEY (`id`), + KEY `idx_source_type_id_token` (`source_type`, `source_id`, `token`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;