event

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2018 License: Apache-2.0, Apache-2.0 Imports: 11 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetQueryConFilter

func GetQueryConFilter(in EventApiInputs) string

func GetSelectConFilter

func GetSelectConFilter(in EventApiInputs) string

func Init

func Init()

Types

type EventApiInputs

type EventApiInputs struct {
	UserName  string   `json:"username"`
	Uic       []string `json:"uic"`
	StartTime int64    `json:"start_time"`
	EndTime   int64    `json:"end_time"`
	Priority  []int    `json:"priority"`
	Status    string   `json:"status"`
	Endpoint  string   `json:"endpoint"`
	Counter   string   `json:"counter"`
	//是否包含故障,包含则传递fault=have
	HaveFault bool `json:"have_fault"`
	//event type, 未恢复报警、历史报警
	NowStatus bool `json:"now_event_status"`
	Limit     int  `json:"limit"`
	Offset    int  `json:"offset"`
}

type EventCases

type EventCases struct {
	gorm.Model
	EventCaseID string `json:"eventcase_id"`
	Endpoint    string `json:"endpoint"`
	Counter     string `json:"counter"`
	Func        string `json:"func"`
	Cond        string `json:"cond"`
	Note        string `json:"note"`
	MaxStep     int    `json:"step"`
	CurrentStep int    `json:"current_step"`
	Priority    int    `json:"priority"`
	Status      string `json:"status"`
	//记录第一次(CURRENT_STEP=1) PROBLEM时间,OK后再PROBLEM被更新
	EventTs string `json:"event_ts"`
	//记录每次被更新的时间
	UpdateAt       string `json:"update_at"`
	ClosedAt       string `json:"closed_at"`
	ClosedNote     string `json:"closed_note"`
	UserModified   int64  `json:"user_modified"`
	TplCreator     string `json:"tpl_creator"`
	ActionConfigID int64  `json:"action_config_id"`
	ExpressionID   int    `json:"expression_id"`
	StrategyID     int    `json:"strategy_id"`
	TemplateID     int    `json:"template_id"`
	ProcessNote    int64  `json:"process_note"`
	ProcessStatus  string `json:"process_status"`
}

func (EventCases) TableName

func (EventCases) TableName() string

type EventCount

type EventCount struct {
	Count int `json:"count"`
}

返回故障数量

type EventFaultInfos

type EventFaultInfos struct {
	Event  EventInfo    `json:"event"`
	Faults []FaultInfos `json:"faults"`
}

type EventInfo

type EventInfo struct {
	ID           uint   `json:"event_id"`
	EventCaseID  string `json:"eventcase_id"`
	Endpoint     string `json:"endpoint"`
	Counter      string `json:"counter"`
	Func         string `json:"func"`
	Cond         string `json:"cond"`
	Note         string `json:"note"`
	MaxStep      int    `json:"max_step"`
	CurrentStep  int    `json:"current_step"`
	Priority     int    `json:"priority"`
	Status       string `json:"status"`
	EventTs      string `json:"event_ts"`
	TplCreator   string `json:"template_creator"`
	ExpressionID int    `json:"expression_id"`
	StrategyID   int    `json:"strategy_id"`
	TemplateID   int    `json:"template_id"`
}

告警事件信息

type EventReceiver

type EventReceiver struct {
	gorm.Model
	EventID        uint   `json:"event_id"`
	ActionConfigID int64  `json:"action_config_id"`
	Uic            string `json:"uic"`
	User           string `json:"user"`
	EventTs        string `json:"event_ts"`
}

func (EventReceiver) TableName

func (EventReceiver) TableName() string

type EventStore

type EventStore struct {
	AMDB   *gorm.DB
	Locker *sync.RWMutex
}
var Store *EventStore

func NewEventStore

func NewEventStore(db *gorm.DB) *EventStore

func (*EventStore) GetEventByID

func (store *EventStore) GetEventByID(id uint) (EventInfo, error)

func (*EventStore) GetEventCount

func (store *EventStore) GetEventCount(in EventApiInputs) (EventCount, error)

func (*EventStore) GetEventsFaultsInfo

func (store *EventStore) GetEventsFaultsInfo(in EventApiInputs) ([]EventFaultInfos, error)

func (*EventStore) GetEventsInfo

func (store *EventStore) GetEventsInfo(in EventApiInputs) ([]EventInfo, error)

func (*EventStore) GetFaultsInfo

func (store *EventStore) GetFaultsInfo(id uint) ([]FaultInfos, error)

func (*EventStore) InsertAlarmEvent

func (store *EventStore) InsertAlarmEvent(eve *coommonModel.Event) error

type Events

type Events struct {
	gorm.Model
	EventCaseID string `json:"eventcase_id"`
	CurrentStep int    `json:"current_step"`
	Cond        string `json:"cond"`
	Status      string `json:"status"`
	EventTs     string `json:"event_ts"`
}

func (Events) TableName

func (Events) TableName() string

type FaultInfos

type FaultInfos struct {
	FaultID   uint   `json:"fault_id"`
	UpdatedAt string `json:"updated_at"`
	Title     string `json:"title"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL