Documentation ¶
Index ¶
- Variables
- func Ormer() orm.Ormer
- func SendAlertsFor(VUG *common.ValidUserGroup) []string
- type Alerts
- func (u *Alerts) AlertsHandler(alert *common.Alerts)
- func (u *Alerts) ClassifyAlerts() map[string]map[string][]OneAlert
- func (u *Alerts) ConfirmAll(confirmList *common.Confirm) error
- func (u *Alerts) GetAlerts(pageNo int64, pageSize int64, timeStart string, timeEnd string, status string, ...) ShowAlerts
- func (u *Alerts) ShowAlerts(ruleId string, start string, pageNo int64, pageSize int64) ShowAlerts
- func (*Alerts) TableName() string
- type Configs
- type Groups
- type Hosts
- type HttpRes
- type Maintains
- type Manages
- type OneAlert
- type Plans
- type Proms
- type Rec
- type Receivers
- type Rules
- type ShowAlerts
- type Users
- func (g *Users) AddUser() error
- func (g *Users) CheckUser(userInfo common.AuthModel) (*common.AuthModel, error)
- func (g *Users) DeleteUsers(id string) error
- func (g *Users) GetAll() []Users
- func (*Users) TableName() string
- func (g *Users) UpdatePassword(name string, oldPassword string, newPassword string) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoService = errors.New("add config failed:the service is not exist,please refresh")
Functions ¶
func Ormer ¶
singleton init ormer ,only use for normal db operation if you begin transaction,please use orm.NewOrm()
func SendAlertsFor ¶
func SendAlertsFor(VUG *common.ValidUserGroup) []string
Types ¶
type Alerts ¶
type Alerts struct { Id int64 `orm:"column(id);auto" json:"id,omitempty"` Rule *Rules `orm:"rel(fk)" json:"rule_id"` Labels string `orm:"column(labels);size(4095)" json:"labels"` Value float64 `orm:"column(value)" json:"value"` Count int `json:"count"` Status int8 `orm:"index" json:"status"` Summary string `orm:"column(summary);size(1023)" json:"summary"` Description string `orm:"column(description);size(1023)" json:"description"` Hostname string `orm:"column(hostname);size(255)" json:"hostname"` ConfirmedBy string `orm:"column(confirmed_by);size(1023)" json:"confirmed_by"` FiredAt *time.Time `orm:"type(datetime)" json:"fired_at"` ConfirmedAt *time.Time `orm:"null" json:"confirmed_at"` ConfirmedBefore *time.Time `orm:"null" json:"confirmed_before"` ResolvedAt *time.Time `orm:"null" json:"resolved_at"` }
func (*Alerts) AlertsHandler ¶
func (*Alerts) ShowAlerts ¶
type Configs ¶
type Configs struct { Id int64 `orm:"auto" json:"id,omitempty"` // 可能带orm标记,就会识别为数据库的字段。带json识别为json的 ServiceId int64 `json:"serviceid"` Idc string `orm:"size(255)" json:"idc"` Proto string `orm:"size(255)" json:"proto"` Auto string `orm:"size(255)" json:"auto"` Port int `json:"port"` Metric string `orm:"size(255)" json:"metric"` }
func (*Configs) DeleteConfig ¶
func (*Configs) GetAllConfig ¶
func (*Configs) UpdateConfig ¶
type Groups ¶
type Groups struct { Id int64 `orm:"auto" json:"id,omitempty"` Name string `orm:"unique;size(255)" json:"name"` User string `orm:"size(1023)" json:"user"` }
func (*Groups) DeleteGroup ¶
func (*Groups) UpdateGroup ¶
type Hosts ¶
type Hosts struct { Id int64 `orm:"auto" json:"id,omitempty"` Mid int64 `json:"mid"` Hostname string `orm:"size(255)" json:"hostname"` }
func (*Hosts) TableUnique ¶
type Maintains ¶
type Maintains struct { Id int64 `orm:"auto" json:"id,omitempty"` Flag bool `json:"flag"` TimeStart string `orm:"size(15)" json:"time_start"` TimeEnd string `orm:"size(15)" json:"time_end"` Month int `json:"month"` DayStart int8 `json:"day_start"` DayEnd int8 `json:"day_end"` //Week_start int8 `json:"week_start"` //Week_end int8 `json:"week_end"` //Month_start int8 `json:"month_start"` //Month_end int8 `json:"month_end"` Valid *time.Time `json:"valid"` }
func (*Maintains) AddMaintains ¶
func (*Maintains) DeleteMaintains ¶
func (*Maintains) GetAllMaintains ¶
func (u *Maintains) GetAllMaintains() interface{}
func (*Maintains) TableIndex ¶
func (*Maintains) UpdateMaintains ¶
type Manages ¶
type Manages struct { Id int64 `orm:"auto" json:"id,omitempty"` ServiceName string `orm:"column(servicename);unique;size(255)" json:"servicename"` Type string `orm:"size(255)" json:"type"` Status int8 `orm:"index" json:"status"` }
func (*Manages) DeleteManage ¶
func (*Manages) GetAllManage ¶
func (*Manages) UpdateManage ¶
type OneAlert ¶
type OneAlert struct { ID int64 `json:"id"` RuleID int64 `json:"rule_id"` Value float64 `json:"value"` Status int8 `json:"status"` Count int `json:"count"` Summary string `json:"summary"` Description string `json:"description"` ConfirmedBy string `json:"confirmed_by"` FiredAt *time.Time `json:"fired_at"` ConfirmedAt *time.Time `json:"confirmed_at"` ConfirmedBefore *time.Time `json:"confirmed_before"` ResolvedAt *time.Time `json:"resolved_at"` }
type Plans ¶
type Plans struct { Id int64 `orm:"auto" json:"id,omitempty"` RuleLabels string `orm:"column(rule_labels);size(255)" json:"rule_labels"` Description string `orm:"column(description);size(1023)" json:"description"` }
func (*Plans) DeletePlan ¶
func (*Plans) GetAllPlans ¶
func (*Plans) UpdatePlan ¶
type Proms ¶
type Proms struct { Id int64 `orm:"auto" json:"id,omitempty"` Name string `orm:"size(1023)" json:"name"` Url string `orm:"size(1023)" json:"url"` }
func (*Proms) DeleteProms ¶
func (*Proms) GetAllProms ¶
func (*Proms) UpdateProms ¶
type Rec ¶
type Rec struct { Id int64 `json:"id,omitempty"` StartTime string `json:"start_time"` EndTime string `json:"end_time"` Start int `json:"start"` Period int `json:"period"` Expression string `json:"expression"` User string `json:"user"` Group string `json:"group"` DutyGroup string `json:"duty_group"` Method string `json:"method"` }
type Receivers ¶
type Receivers struct { Id int64 `orm:"auto" json:"id,omitempty"` Plan *Plans `orm:"index;rel(fk)" json:"plan_id"` StartTime string `orm:"size(31)" json:"start_time"` EndTime string `orm:"size(31)" json:"end_time"` Start int `json:"start"` Period int `json:"period"` Expression string `orm:"size(1023)" json:"expression"` ReversePolishNotation string `orm:"size(1023)" json:"reverse_polish_notation"` User string `orm:"size(1023)" json:"user"` Group string `orm:"size(1023)" json:"group"` DutyGroup string `orm:"size(255)" json:"duty_group"` Method string `orm:"size(255)" json:"method"` }
func (*Receivers) AddReceiver ¶
func (*Receivers) DeleteReceiver ¶
func (*Receivers) GetAllReceivers ¶
func (*Receivers) UpdateReceiver ¶
type Rules ¶
type Rules struct { Id int64 `orm:"column(id);auto" json:"id,omitempty"` Expr string `orm:"column(expr);size(1023)" json:"expr"` Op string `orm:"column(op);size(31)" json:"op"` Value string `orm:"column(value);size(1023)" json:"op"` For string `orm:"column(for);size(1023)" json:"for"` Summary string `orm:"column(summary);size(1023)" json:"summary"` Description string `orm:"column(description);size(1023)" json:"description"` Prom *Proms `orm:"rel(fk)" json:"prom_id"` Plan *Plans `orm:"rel(fk)" json:"plan_id"` }
func (*Rules) DeleteRule ¶
func (*Rules) InsertRule ¶
func (*Rules) UpdateRule ¶
type ShowAlerts ¶
type ShowAlerts struct { Alerts []common.AlertForShow `json:"alerts"` Total int64 `json:"total"` }
Click to show internal directories.
Click to hide internal directories.