未验证 提交 60bf8139 编写于 作者: X xtan 提交者: GitHub

feat: add eventid to ibex task_record (#1497)

上级 fc0d077c
......@@ -154,6 +154,7 @@ func handleIbex(ctx *ctx.Context, url string, event *models.AlertCurEvent, targe
// write db
record := models.TaskRecord{
Id: res.Dat,
EventId: event.Id,
GroupId: tpl.GroupId,
IbexAddress: ibexConf.Address,
IbexAuthUser: ibexConf.BasicAuthUser,
......
......@@ -651,6 +651,7 @@ 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 '',
......@@ -669,9 +670,10 @@ CREATE TABLE task_record
) ;
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
(
......
......@@ -531,6 +531,7 @@ CREATE TABLE `task_tpl_host`
CREATE TABLE `task_record`
(
`id` bigint unsigned not null comment 'ibex task id',
`event_id` bigint not null comment 'event id' default 0,
`group_id` bigint not null comment 'busi group id',
`ibex_address` varchar(128) not null,
`ibex_auth_user` varchar(128) not null default '',
......@@ -547,7 +548,8 @@ CREATE TABLE `task_record`
`create_by` varchar(64) not null default '',
PRIMARY KEY (`id`),
KEY (`create_at`, `group_id`),
KEY (`create_by`)
KEY (`create_by`),
KEY (`event_id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;
CREATE TABLE `alerting_engines`
......
......@@ -4,6 +4,7 @@ import "github.com/ccfos/nightingale/v6/pkg/ctx"
type TaskRecord struct {
Id int64 `json:"id" gorm:"primaryKey"`
EventId int64 `json:"event_id"`
GroupId int64 `json:"group_id"`
IbexAddress string `json:"ibex_address"`
IbexAuthUser string `json:"ibex_auth_user"`
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册