falconPortal

package
v3.12.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2017 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const SkipFilter = "ALL"

Variables

This section is empty.

Functions

func AddNote

func AddNote(username string, processNote string, eventcaseid string, processStatus string, bossId string) (err error)

func CloseEvent

func CloseEvent(username string, colsed_note string, id string) (err error)

will deprecated

func CountNumOfTlp

func CountNumOfTlp() (c int, err error)

func GetActionIdsFromTeamNames

func GetActionIdsFromTeamNames(teamNames string) ([]int, string, error)

get actionIds from teamNames

func GetCasePermission

func GetCasePermission(username string) (isAdmin bool, tplIds string, err error)

func GetTeamIdsFromUser

func GetTeamIdsFromUser(uid int64) ([]int64, string, error)

get teamid from userid

func GetTeamNameFromTeamIds

func GetTeamNameFromTeamIds(teamIds []int64) ([]int64, string)

get teamNames from teamids

func GetTplIdFromActionId

func GetTplIdFromActionId(aids string) ([]int, string, error)

func UpdateCloseNote

func UpdateCloseNote(eventCaseID []string, closedNote string) error

func WhenEndpointOnMaintain

func WhenEndpointOnMaintain(hostId int, maintainBegin int64, maintainEnd int64) (err error, affectedRows int)

func WhenEndpointUnbind

func WhenEndpointUnbind(hostId int, hostgroupId int) (err error, affectedRows int)

func WhenStrategyDeleted

func WhenStrategyDeleted(strategyId int) (err error, affectedRows int)

func WhenStrategyUpdated

func WhenStrategyUpdated(strategyId int) (err error, affectedRows int)

func WhenTempleteDeleted

func WhenTempleteDeleted(templateId int) (err error, affectedRows int)

func WhenTempleteUnbind

func WhenTempleteUnbind(templateId int, hostgroupId int) (err error, affectedRows int)

Types

type Action

type Action struct {
	Id                 int    `json:"id"`
	Uic                string `json:"uic"`
	Url                string `json:"url"`
	Callback           int    `json:"callback"`
	BeforeCallbackSms  int    `json:"before_callback_sms"`
	BeforeCallbackMail int    `json:"before_callback_mail"`
	AfterCallbackSms   int    `json:"after_callback_sms"`
	AfterCallbackMail  int    `json:"after_callback_mail"`
}

type AlarmType

type AlarmType struct {
	Id           int       `json:"id" orm:"pk"`
	Name         string    `json:"name" orm:"column(name)"`
	Color        string    `json:"color" orm:"column(color)"`
	InternalData int       `json:"internal_data" orm:"column(internal_data)"`
	Description  string    `json:"description" orm:"column(description)"`
	Created      time.Time `json:"created" orm:"column(created)"`
}

func GetAlarmTypeById

func GetAlarmTypeById(id int) AlarmType

type AlertsResp

type AlertsResp struct {
	// //make compatible for overall , if need it, please uncomment below
	// AlarmResp
	PlatformExtend
	Hash       string `json:"hash"`
	CTmpName   string `json:"c_tmp_name"`
	HostName   string `json:"hostname"`
	Metric     string `json:"metric"`
	Author     string `json:"author"`
	TemplateID int    `json:"templateID"`
	Priority   string `json:"priority"`
	Severity   string `json:"severity"`
	Status     string `json:"status"`
	StatusRaw  string `json:"statusRaw"`
	//metricTyoe
	Type       string              `json:"type"`
	Content    string              `json:"content"`
	TimeStart  int64               `json:"timeStart"`
	TimeUpdate int64               `json:"timeUpdate"`
	Notes      []map[string]string `json:"notes"`
	Events     []*Events           `json:"events"`
	Process    string              `json:"process"`
	Function   string              `json:"function"`
	Condition  string              `json:"condition"`
	StepLimit  int                 `json:"stepLimit"`
	Step       int                 `json:"step"`
	// add by 201707
	Activate     int    `json:"active"`
	AlarmType    string `json:"alarm_type"`
	AlarmColor   string `json:"alarm_color"`
	ExtendedBlob string `json:"extended_blob"`
	InternalData int    `json:"internal_data"`
}

func AlertsConvert

func AlertsConvert(result []EventCases) (resp []AlertsResp, endpointSet *hashset.Set, err error)

func GetAlertInfo

func GetAlertInfo(resp []AlertsResp, endpointList *hashset.Set, showAll bool) (respComplete []AlertsResp)

func GetAlertInfoFromDB

func GetAlertInfoFromDB(resp []AlertsResp, endpointList *hashset.Set, showAll bool) (respComplete []AlertsResp)

func GetAlertsNotes

func GetAlertsNotes(alerts []AlertsResp) (alertsResp []AlertsResp)

type EventCases

type EventCases struct {
	// uniuq
	Id       string `json:"id" orm:"pk"`
	Endpoint string `json:"endpoint"`
	Metric   string `json:"metric"`
	Func     string `json:"func"`
	Cond     string `json:"cond"`
	Note     string `json:"note"`
	//leftValue + operator + rightValue
	MaxStep       int       `json:"max_step"`
	CurrentStep   int       `json:"current_step"`
	Priority      int       `json:"priority"`
	Status        string    `json:"status"`
	Timestamp     time.Time `json:"start_at"`
	UpdateAt      time.Time `json:"update_at"`
	ProcessNote   int       `json:"process_note"`
	ProcessStatus string    `json:"process_status"`
	TplCreator    string    `json:"tpl_creator"`
	ExpressionId  int       `json:"expression_id"`
	StrategyId    int       `json:"strategy_id"`
	TemplateId    int       `json:"template_id"`
	Events        []*Events `json:"evevnts" orm:"reverse(many)"`
	AlarmTypeId   int       `json:"alarm_type_id"`
	Ip            string    `json:"ip" orm:"column(ip)`
	Platform      string    `json:"platform" orm:"column(platform)`
	Idc           string    `json:"idc" orm:"column(idc)"`
	Contact       string    `json:"contact" orm:"column(contact)"`
	ExtendedBlob  string    `json:"extended_blob" orm:"column(extended_blob)"`
}

func GetEventCases

func GetEventCases(includeEvents bool, startTime int64, endTime int64, priority string, status string, progressStatus string, limit int, elimit int, username string, metrics string, caseId string) (result []EventCases, err error)

func (EventCases) AlarmType

func (mine EventCases) AlarmType() AlarmType

type EventNote

type EventNote struct {
	Id          int       `json:"id" orm:"pk"`
	EventCaseId string    `json:"event_caseId" orm:"column(event_caseId)"`
	Note        string    `json:"note"`
	CaseId      string    `json:"case_id"`
	Status      string    `json:"status"`
	Timestamp   time.Time `json:"timestamp"`
	UserId      int64     `json:"-"`
	UserName    string    `json:"user_name" orm:"column(user_name)"`
}

func GetNote

func GetNote(noteId int64) (EventNote, error)

func GetNotes

func GetNotes(eventCaseId string, limit int, startTime int64, endTime int64, filterIgnored bool) (enotes []EventNote, err error)

type Events

type Events struct {
	Id          int         `json:"id" orm:"pk"`
	Step        int         `json:"step"`
	Cond        string      `json:"cond"`
	Status      int         `json:"status"`
	Timestamp   time.Time   `json:"timestamp"`
	EventCaseId *EventCases `json:"event_caseId" orm:"rel(fk)"`
}

type EventsRsp

type EventsRsp struct {
	Id         int       `json:"id"`
	Step       int       `json:"step"`
	Cond       string    `json:"cond"`
	Status     int       `json:"status"`
	Timestamp  time.Time `json:"timestamp"`
	Eid        string    `json:"event_caseId" orm:"column(eid)"`
	TplCreator string    `json:"tpl_creator"`
	Metric     string    `json:"metric"`
	Endpoint   string    `json:"endpoint"`
}

func GetEvents

func GetEvents(startTime int64, endTime int64, status string, limit int, caseId string) (result []EventsRsp, err error)

type Host

type Host struct {
	Id            int    `json:"id" orm:"pk"`
	Hostname      string `json:"hostname" orm:"column(hostname)"`
	Ip            string
	AgentVersion  string
	PluginVersion string
	MaintainBegin int64
	MaintainEnd   int64
	UpdateAt      time.Time
}

type PlatformExtend

type PlatformExtend struct {
	Contact  []boss.Contactor `json:"contact"`
	IDC      string           `json:"idc"`
	IP       string           `json:"ip"`
	Platform string           `json:"platform"`
}

type Tpl

type Tpl struct {
	Id         int    `json:"id" orm:"pk"`
	TplName    string `json:"tpl_name"`
	ParentId   string `json:"parent_id "`
	ActionId   string `json:"action_id"`
	CreateUser string `json:"create_user"`
	CreateAt   string `json:"create_at"`
}

Jump to

Keyboard shortcuts

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