Documentation ¶
Index ¶
- Constants
- Variables
- func AlertEventTotal(stime, etime int64, query string, status, priority int) (num int64, err error)
- func AlertEventsDel(ids []int64) error
- func AlertRuleCount(where string, args ...interface{}) (num int64, err error)
- func AlertRuleGroupCount(where string, args ...interface{}) (num int64, err error)
- func AlertRuleGroupFavoriteAdd(groupId, userId int64) error
- func AlertRuleGroupFavoriteCount(where string, args ...interface{}) (int64, error)
- func AlertRuleGroupFavoriteDel(groupId, userId int64) error
- func AlertRuleGroupFavoriteGetGroupIds(userId int64) ([]int64, error)
- func AlertRuleGroupTotal(query string) (num int64, err error)
- func AlertRuleTotal(query string) (num int64, err error)
- func AlertRuleUpdateAppendTags(ids []int64, appendTags, username string) error
- func AlertRuleUpdateGroup(alertRuleIds []int64, groupId int64) error
- func AlertRuleUpdateNotifyChannels(ids []int64, notifyChannels, username string) error
- func AlertRuleUpdateNotifyGroups(ids []int64, notifyGroups, notifyUsers, username string) error
- func AlertRuleUpdateStatus(ids []int64, status int, username string) error
- func AlertRulesDel(ids []int64) error
- func BindOrphanToPresetClasspath()
- func ClasspathCount(where string, args ...interface{}) (num int64, err error)
- func ClasspathFavoriteAdd(ClasspathId, userId int64) error
- func ClasspathFavoriteCount(where string, args ...interface{}) (int64, error)
- func ClasspathFavoriteDel(classpathId int64, userId int64) error
- func ClasspathFavoriteGetClasspathIds(userId int64) ([]int64, error)
- func ClasspathResourceAdd(classpathId int64, resIdent string) error
- func ClasspathResourceCount(where string, args ...interface{}) (num int64, err error)
- func ClasspathResourceDel(classpathId int64, idents []string) error
- func ClasspathTotal(query string) (num int64, err error)
- func CollectRuleCount(where string, args ...interface{}) (num int64, err error)
- func CollectRulesDel(ids []int64) error
- func ConfigsGet(ckey string) (string, error)
- func ConfigsGets(ckeys []string) (map[string]string, error)
- func ConfigsSet(ckey, cval string) error
- func CryptoPass(raw string) (string, error)
- func DBInsertOne(bean interface{}) error
- func DashboardCount(where string, args ...interface{}) (num int64, err error)
- func DashboardFavoriteAdd(dashboardId, userId int64) error
- func DashboardFavoriteCount(where string, args ...interface{}) (int64, error)
- func DashboardFavoriteDel(dashboardId, userId int64) error
- func DashboardFavoriteGetDashboardIds(userId int64) ([]int64, error)
- func DashboardTotal(onlyfavorite bool, ids []int64, query string) (num int64, err error)
- func HistoryAlertEventsTotal(stime, etime int64, query string, status, isRecovery, priority int) (num int64, err error)
- func InitError()
- func InitLdap(ldap LdapSection)
- func InitMySQL(MySQL MysqlSection)
- func InitRoot()
- func InitSalt()
- func InstanceDelDead(service string, endpoints []string) error
- func InstanceGetAlive(service string) ([]string, error)
- func InstanceGetDead(service string) ([]string, error)
- func InstanceHeartbeat(service, endpoint string) error
- func ListInsert(obj Classpath, node *ClasspathNode)
- func MetricDescriptionDel(ids []int64) error
- func MetricDescriptionMapper(metrics []string) (map[string]string, error)
- func MetricDescriptionTotal(query string) (num int64, err error)
- func MetricDescriptionUpdate(mds []MetricDescription) error
- func MuteCleanExpire() error
- func MuteTotal(query string) (num int64, err error)
- func ResourceAliasMapper() (map[string]string, error)
- func ResourceCleanExpire() error
- func ResourceTotal(query string) (int64, error)
- func ResourceTotalByClasspathId(classpathIds []int64, query string) (int64, error)
- func ResourceTotalByClasspathQuery(qpaths []int64, qres string) (int64, error)
- func ResourceUpdateMute(ids []int64, btime, etime int64) error
- func ResourceUpdateNote(ids []int64, note string) error
- func ResourceUpdateTags(ids []int64, tags string) error
- func RoleHasOperation(roles []string, operation string) (bool, error)
- func UpdateAlias() error
- func UserGroupCount(where string, args ...interface{}) (num int64, err error)
- func UserGroupMemberAdd(groupId, userId int64) error
- func UserGroupMemberCount(where string, args ...interface{}) (int64, error)
- func UserGroupMemberDel(groupId int64, userIds []int64) error
- func UserGroupTotal(query string) (num int64, err error)
- func UserTotal(query string) (num int64, err error)
- type AlertEvent
- func (ae *AlertEvent) Add() error
- func (ar *AlertEvent) Del() error
- func (ar *AlertEvent) DelByHashId() error
- func (ae *AlertEvent) FillObjs() error
- func (ae *AlertEvent) GetHistoryPoints() ([]vos.HistoryPoints, error)
- func (ar *AlertEvent) HashIdExists() (bool, error)
- func (ae *AlertEvent) IsAlert() bool
- func (ae *AlertEvent) IsRecov() bool
- func (ae *AlertEvent) MarkAlert()
- func (ae *AlertEvent) MarkMuted()
- func (ae *AlertEvent) MarkRecov()
- func (ae *AlertEvent) String() string
- func (ae *AlertEvent) TableName() string
- type AlertRule
- type AlertRuleGroup
- type AlertRuleGroupFavorite
- type AlertRuleStatistic
- type AliasTime
- type Chart
- type ChartGroup
- type ChartTmp
- type Classpath
- func (c *Classpath) Add() error
- func (c *Classpath) AddResources(idents []string) error
- func (c *Classpath) Del() error
- func (c *Classpath) DelResources(idents []string) error
- func (cp *Classpath) DirectChildren() ([]Classpath, error)
- func (c *Classpath) TableName() string
- func (c *Classpath) Update(cols ...string) error
- func (c *Classpath) Validate() error
- type ClasspathFavorite
- type ClasspathNode
- type ClasspathResource
- type CollectRule
- type Configs
- type Dashboard
- type DashboardFavorite
- type Exp
- type HistoryAlertEvent
- func (hae *HistoryAlertEvent) Add() error
- func (hae *HistoryAlertEvent) FillObjs() error
- func (hae *HistoryAlertEvent) IsAlert() bool
- func (hae *HistoryAlertEvent) IsRecov() bool
- func (hae *HistoryAlertEvent) MarkAlert()
- func (hae *HistoryAlertEvent) MarkMuted()
- func (hae *HistoryAlertEvent) MarkRecov()
- type Instance
- type LdapSection
- type LogConfig
- type MetricDescription
- type Mute
- type MysqlSection
- type PortConfig
- type ProcConfig
- type PullExpression
- type PushExpression
- type ResFilter
- type Resource
- func ResourceGet(where string, args ...interface{}) (*Resource, error)
- func ResourceGetAll() ([]Resource, error)
- func ResourceGets(query string, limit, offset int) ([]Resource, error)
- func ResourceGetsByClasspathId(classpathIds []int64, query string, limit, offset int) ([]Resource, error)
- func ResourceGetsByClasspathQuery(qpaths []int64, qres string, limit, offset int) ([]Resource, error)
- type Role
- type RoleOperation
- type ScriptConfig
- type TagFilter
- type User
- func LdapLogin(username, pass string) (*User, error)
- func PassLogin(username, pass string) (*User, error)
- func UserGet(where string, args ...interface{}) (*User, error)
- func UserGetAll() ([]User, error)
- func UserGetById(id int64) (*User, error)
- func UserGetByUsername(username string) (*User, error)
- func UserGets(query string, limit, offset int) ([]User, error)
- func UserGetsByIds(ids []int64) ([]User, error)
- func UserGetsByIdsStr(ids []string) ([]User, error)
- func (u *User) Add() error
- func (u *User) CanDo(op string) (bool, error)
- func (u *User) CanModifyUserGroup(ug *UserGroup) (bool, error)
- func (u *User) ChangePassword(oldpass, newpass string) error
- func (u *User) Del() error
- func (u *User) FavoriteAlertRuleGroupIds() ([]int64, error)
- func (u *User) FavoriteAlertRuleGroups() ([]AlertRuleGroup, error)
- func (u *User) FavoriteClasspathIds() ([]int64, error)
- func (u *User) FavoriteClasspaths() ([]Classpath, error)
- func (u *User) FavoriteDashboardIds() ([]int64, error)
- func (u *User) MustPerm(op string) *User
- func (u *User) MyUserGroups() ([]UserGroup, error)
- func (u *User) TableName() string
- func (u *User) Update(cols ...string) error
- func (u *User) UserGroupIds() ([]int64, error)
- func (u *User) Validate() error
- type UserGroup
- func (ug *UserGroup) Add() error
- func (ug *UserGroup) AddMembers(userIds []int64) error
- func (ug *UserGroup) Del() error
- func (ug *UserGroup) DelMembers(userIds []int64) error
- func (ug *UserGroup) MemberIds() ([]int64, error)
- func (ug *UserGroup) TableName() string
- func (ug *UserGroup) Update(cols ...string) error
- func (ug *UserGroup) Validate() error
- type UserGroupMember
- type UserToken
Constants ¶
View Source
const ALERT_RULE_ACTIVE = 0
View Source
const ALERT_RULE_DISABLED = 1
View Source
const PULL = 1
View Source
const PUSH = 0
Variables ¶
View Source
var AliasMapper = cmap.New()
View Source
var DB *xorm.Engine
Functions ¶
func AlertEventTotal ¶
func AlertEventsDel ¶
func AlertRuleCount ¶
func AlertRuleGroupCount ¶
func AlertRuleGroupTotal ¶
func AlertRuleTotal ¶
func AlertRuleUpdateGroup ¶
func AlertRuleUpdateStatus ¶
func AlertRulesDel ¶
func BindOrphanToPresetClasspath ¶
func BindOrphanToPresetClasspath()
如果发现资源没有在all这个classpath下,就把它加进来
func ClasspathCount ¶
func ClasspathFavoriteAdd ¶
func ClasspathFavoriteCount ¶
func ClasspathFavoriteDel ¶
func ClasspathResourceAdd ¶
func ClasspathResourceCount ¶
func ClasspathResourceDel ¶
func ClasspathTotal ¶
func CollectRuleCount ¶
func CollectRulesDel ¶
func ConfigsGet ¶
func ConfigsSet ¶
func DBInsertOne ¶
func DBInsertOne(bean interface{}) error
func DashboardCount ¶
func DashboardFavoriteAdd ¶
func DashboardFavoriteCount ¶
func DashboardFavoriteDel ¶
func DashboardTotal ¶
func HistoryAlertEventsTotal ¶
func InitLdap ¶
func InitLdap(ldap LdapSection)
func InitMySQL ¶
func InitMySQL(MySQL MysqlSection)
func InstanceDelDead ¶
func InstanceGetAlive ¶
func InstanceGetDead ¶
func InstanceHeartbeat ¶
func ListInsert ¶
func ListInsert(obj Classpath, node *ClasspathNode)
func MetricDescriptionDel ¶
func MetricDescriptionMapper ¶
MetricDescriptionMapper 即时看图页面,应该会用到这个方法,填充metric对应的description
func MetricDescriptionTotal ¶
func MetricDescriptionUpdate ¶
func MetricDescriptionUpdate(mds []MetricDescription) error
func MuteCleanExpire ¶
func MuteCleanExpire() error
MuteCleanExpire 这个方法应该由cron调用,所以返回error不需要是用户友好的
func ResourceAliasMapper ¶
ResourceAliasMapper 返回map,key是ident,value是alias
func ResourceCleanExpire ¶
func ResourceCleanExpire() error
func ResourceTotal ¶
ResourceTotal query resource only
func ResourceTotalByClasspathQuery ¶
这个sql写法很简单,只是不知道性能是否会是问题
func ResourceUpdateMute ¶
func ResourceUpdateNote ¶
func ResourceUpdateTags ¶
资源tags这个更新,一定要认真校验tags格式,后面会把这个tags附到监控数据里
func UpdateAlias ¶
func UpdateAlias() error
func UserGroupCount ¶
func UserGroupMemberAdd ¶
func UserGroupMemberCount ¶
func UserGroupMemberDel ¶
func UserGroupTotal ¶
Types ¶
type AlertEvent ¶
type AlertEvent struct { Id int64 `json:"id"` RuleId int64 `json:"rule_id"` RuleName string `json:"rule_name"` RuleNote string `json:"rule_note"` // ProcessorUid int64 `json:"processor_uid"` // ProcessorObj User `json:"processor_user_obj" xorm:"-"` // EventNote string `json:"event_note"` HashId string `json:"hash_id"` // 唯一标识 IsPromePull int `json:"is_prome_pull"` // 代表是否是prometheus pull告警,为1时前端使用 ReadableExpression 拉取最近1小时数据 LastSend bool `json:"last_sent" xorm:"-"` // true 代表上次发了,false代表还没发:给prometheus做for判断的 AlertDuration int64 `xorm:"-" json:"alert_duration"` // 告警统计周期,PULL模型会当做P8S的for时间 ResClasspaths string `json:"res_classpaths"` ResIdent string `json:"res_ident" xorm:"-"` // res_ident会出现在tags字段,就不用单独写入数据库了,但是各块逻辑中有个单独的res_ident字段更便于处理,所以struct里还留有这个字段;前端不用展示这个字段 Priority int `json:"priority"` Status int `json:"status"` // 标识是否 被屏蔽 IsRecovery int `json:"is_recovery" xorm:"-"` // 0: alert, 1: recovery HistoryPoints json.RawMessage `json:"history_points"` // HistoryPoints{} TriggerTime int64 `json:"trigger_time"` Values string `json:"values" xorm:"-"` // e.g. cpu.idle: 23.3; load.1min: 32 NotifyChannels string `json:"notify_channels"` NotifyGroups string `json:"notify_groups"` NotifyUsers string `json:"notify_users"` RunbookUrl string `json:"runbook_url"` ReadableExpression string `json:"readable_expression"` // e.g. mem.bytes.used.percent(all,60s) > 0 Tags string `json:"tags"` // merge data_tags rule_tags and res_tags NotifyGroupObjs []UserGroup `json:"notify_group_objs" xorm:"-"` NotifyUserObjs []User `json:"notify_user_objs" xorm:"-"` TagMap map[string]string `json:"tag_map" xorm:"-"` }
func AlertEventGet ¶
func AlertEventGet(where string, args ...interface{}) (*AlertEvent, error)
func AlertEventGetAll ¶
func AlertEventGetAll() ([]*AlertEvent, error)
func AlertEventGets ¶
func (*AlertEvent) Add ¶
func (ae *AlertEvent) Add() error
func (*AlertEvent) Del ¶
func (ar *AlertEvent) Del() error
func (*AlertEvent) DelByHashId ¶
func (ar *AlertEvent) DelByHashId() error
func (*AlertEvent) FillObjs ¶
func (ae *AlertEvent) FillObjs() error
func (*AlertEvent) GetHistoryPoints ¶
func (ae *AlertEvent) GetHistoryPoints() ([]vos.HistoryPoints, error)
func (*AlertEvent) HashIdExists ¶
func (ar *AlertEvent) HashIdExists() (bool, error)
func (*AlertEvent) IsAlert ¶
func (ae *AlertEvent) IsAlert() bool
IsAlert 语法糖,避免直接拿IsRecovery字段做比对不直观易出错
func (*AlertEvent) IsRecov ¶
func (ae *AlertEvent) IsRecov() bool
IsRecov 语法糖,避免直接拿IsRecovery字段做比对不直观易出错
func (*AlertEvent) String ¶
func (ae *AlertEvent) String() string
func (*AlertEvent) TableName ¶
func (ae *AlertEvent) TableName() string
type AlertRule ¶
type AlertRule struct { Id int64 `json:"id"` GroupId int64 `json:"group_id"` Name string `json:"name"` Type int `json:"type"` // 0: nightingale, 1: prometheus Expression json.RawMessage `json:"expression"` Status int `json:"status"` // 0: active, 1: disabled AppendTags string `json:"append_tags"` EnableStime string `json:"enable_stime"` EnableEtime string `json:"enable_etime"` EnableDaysOfWeek string `json:"enable_days_of_week"` RecoveryNotify int `json:"recovery_notify"` Priority int `json:"priority"` NotifyChannels string `json:"notify_channels"` NotifyGroups string `json:"notify_groups"` NotifyUsers string `json:"notify_users"` Callbacks string `json:"callbacks"` RunbookUrl string `json:"runbook_url"` Note string `json:"note"` CreateAt int64 `json:"create_at"` CreateBy string `json:"create_by"` UpdateAt int64 `json:"update_at"` UpdateBy string `json:"update_by"` AlertDuration int `json:"alert_duration"` // 告警统计周期,PULL模型会当做P8S的for时间 PushExpr PushExpression `xorm:"-" json:"-"` PullExpr PullExpression `xorm:"-" json:"-"` FirstMetric string `xorm:"-" json:"-"` // Exps里可能有多个metric,只取第一个,给后续制作map使用 NotifyUsersDetail []*User `xorm:"-" json:"notify_users_detail"` NotifyGroupsDetail []*UserGroup `xorm:"-" json:"notify_groups_detail"` }
func AlertRuleGet ¶
func AlertRulesOfGroup ¶
func AllAlertRules ¶
type AlertRuleGroup ¶
type AlertRuleGroup struct { Id int64 `json:"id"` Name string `json:"name"` UserGroupIds string `json:"user_group_ids"` CreateAt int64 `json:"create_at"` CreateBy string `json:"create_by"` UpdateAt int64 `json:"update_at"` UpdateBy string `json:"update_by"` UserGroups []UserGroup `json:"user_groups" xorm:"-"` }
func AlertRuleGroupGet ¶
func AlertRuleGroupGet(where string, args ...interface{}) (*AlertRuleGroup, error)
func AlertRuleGroupGets ¶
func AlertRuleGroupGets(query string, limit, offset int) ([]AlertRuleGroup, error)
func (*AlertRuleGroup) Add ¶
func (arg *AlertRuleGroup) Add() error
func (*AlertRuleGroup) Del ¶
func (arg *AlertRuleGroup) Del() error
Del AlertRuleGroup删除,前提是下面没有AlertRule了
func (*AlertRuleGroup) FillUserGroups ¶
func (arg *AlertRuleGroup) FillUserGroups() error
func (*AlertRuleGroup) TableName ¶
func (arg *AlertRuleGroup) TableName() string
func (*AlertRuleGroup) Update ¶
func (arg *AlertRuleGroup) Update(cols ...string) error
func (*AlertRuleGroup) Validate ¶
func (arg *AlertRuleGroup) Validate() error
type AlertRuleGroupFavorite ¶
func (AlertRuleGroupFavorite) TableName ¶
func (AlertRuleGroupFavorite) TableName() string
type AlertRuleStatistic ¶
type AlertRuleStatistic struct { Count int64 `json:"count"` MaxUpdateAt int64 `json:"max_update_at"` }
func GetAlertRuleStatistic ¶
func GetAlertRuleStatistic() (AlertRuleStatistic, error)
type Chart ¶
type ChartGroup ¶
type ChartGroup struct { Id int64 `json:"id"` DashboardId int64 `json:"dashboard_id"` Name string `json:"name"` Weight int `json:"weight"` }
func ChartGroupGet ¶
func ChartGroupGet(where string, args ...interface{}) (*ChartGroup, error)
func ChartGroupGets ¶
func ChartGroupGets(dashboardId int64) ([]ChartGroup, error)
func (*ChartGroup) Add ¶
func (cg *ChartGroup) Add() error
func (*ChartGroup) Del ¶
func (cg *ChartGroup) Del() error
func (*ChartGroup) TableName ¶
func (cg *ChartGroup) TableName() string
func (*ChartGroup) Update ¶
func (cg *ChartGroup) Update(cols ...string) error
func (*ChartGroup) Validate ¶
func (cg *ChartGroup) Validate() error
type ChartTmp ¶
type ChartTmp struct { Id int64 `json:"id"` Configs string `json:"configs"` CreateBy string `json:"create_by"` CreateAt int64 `json:"create_at"` }
func ChartTmpGet ¶
type Classpath ¶
type Classpath struct { Id int64 `json:"id"` Path string `json:"path"` Note string `json:"note"` Preset int `json:"preset"` CreateAt int64 `json:"create_at"` CreateBy string `json:"create_by"` UpdateAt int64 `json:"update_at"` UpdateBy string `json:"update_by"` }
func ClasspathGet ¶
func ClasspathGetAll ¶
func ClasspathGetsByPrefix ¶
func (*Classpath) AddResources ¶
func (*Classpath) DelResources ¶
func (*Classpath) DirectChildren ¶
type ClasspathFavorite ¶
func (ClasspathFavorite) TableName ¶
func (ClasspathFavorite) TableName() string
type ClasspathNode ¶
type ClasspathNode struct { Id int64 `json:"id"` Path string `json:"path"` Note string `json:"note"` Preset int `json:"preset"` Children []*ClasspathNode `json:"children"` }
func ClasspathNodeAllChildren ¶
func ClasspathNodeAllChildren(cps []Classpath) []*ClasspathNode
func ClasspathNodeGets ¶
func ClasspathNodeGets(query string) ([]*ClasspathNode, error)
func ToClasspathNode ¶
func ToClasspathNode(cp Classpath, path string) ClasspathNode
type ClasspathResource ¶
func ClasspathResourceGetAll ¶
func ClasspathResourceGetAll() ([]ClasspathResource, error)
func ClasspathResourceGets ¶
func ClasspathResourceGets(where string, args ...interface{}) ([]ClasspathResource, error)
func (ClasspathResource) TableName ¶
func (ClasspathResource) TableName() string
type CollectRule ¶
type CollectRule struct { Id int64 `json:"id"` ClasspathId int64 `json:"classpath_id"` PrefixMatch int `json:"prefix_match"` Name string `json:"name"` Note string `json:"note"` Step int `json:"step"` Type string `json:"type"` Data string `json:"data"` AppendTags string `json:"append_tags"` CreateAt int64 `json:"create_at"` CreateBy string `json:"create_by"` UpdateAt int64 `json:"update_at"` UpdateBy string `json:"update_by"` }
func CollectRuleGet ¶
func CollectRuleGet(where string, args ...interface{}) (*CollectRule, error)
func CollectRuleGetAll ¶
func CollectRuleGetAll() ([]*CollectRule, error)
func CollectRuleGets ¶
func CollectRuleGets(where string, args ...interface{}) ([]CollectRule, error)
CollectRuleGets 量不大,前端检索和排序
func (*CollectRule) Add ¶
func (cr *CollectRule) Add() error
func (*CollectRule) Del ¶
func (cr *CollectRule) Del() error
func (*CollectRule) TableName ¶
func (cr *CollectRule) TableName() string
func (*CollectRule) Update ¶
func (cr *CollectRule) Update(cols ...string) error
func (*CollectRule) Validate ¶
func (cr *CollectRule) Validate() error
type Dashboard ¶
type Dashboard struct { Id int64 `json:"id"` Name string `json:"name"` Tags string `json:"tags"` Configs string `json:"configs"` Favorite int `json:"favorite" xorm:"-"` CreateAt int64 `json:"create_at"` CreateBy string `json:"create_by"` UpdateAt int64 `json:"update_at"` UpdateBy string `json:"update_by"` }
func DashboardGet ¶
func DashboardGets ¶
func DashboardGetsByIds ¶
func (*Dashboard) FillFavorite ¶
type DashboardFavorite ¶
func (DashboardFavorite) TableName ¶
func (DashboardFavorite) TableName() string
type HistoryAlertEvent ¶
type HistoryAlertEvent struct { Id int64 `json:"id"` RuleId int64 `json:"rule_id"` RuleName string `json:"rule_name"` RuleNote string `json:"rule_note"` //ProcessorUid int64 `json:"processor_uid"` //ProcessorObj User `json:"processor_user_objs" xorm:""` //EventNote string `json:"event_note"` HashId string `json:"hash_id"` // 唯一标识 IsPromePull int `json:"is_prome_pull"` // 代表是否是prometheus pull告警,为1时前端使用 ReadableExpression 拉取最近1小时数据 ResClasspaths string `json:"res_classpaths"` ResIdent string `json:"res_ident" xorm:"-"` // res_ident会出现在tags字段,就不用单独写入数据库了,但是各块逻辑中有个单独的res_ident字段更便于处理,所以struct里还留有这个字段;前端不用展示这个字段 Priority int `json:"priority"` Status int `json:"status"` // 标识是否 被屏蔽 IsRecovery int `json:"is_recovery"` // 0: alert, 1: recovery HistoryPoints json.RawMessage `json:"history_points"` // HistoryPoints{} TriggerTime int64 `json:"trigger_time"` Values string `json:"values" xorm:"-"` // e.g. cpu.idle: 23.3; load.1min: 32 NotifyChannels string `json:"notify_channels"` NotifyGroups string `json:"notify_groups"` NotifyUsers string `json:"notify_users"` RunbookUrl string `json:"runbook_url"` ReadableExpression string `json:"readable_expression"` // e.g. mem.bytes.used.percent(all,60s) > 0 Tags string `json:"tags"` // merge data_tags rule_tags and res_tags NotifyGroupObjs []UserGroup `json:"notify_group_objs" xorm:"-"` NotifyUserObjs []User `json:"notify_user_objs" xorm:"-"` }
func HistoryAlertEventGet ¶
func HistoryAlertEventGet(where string, args ...interface{}) (*HistoryAlertEvent, error)
func HistoryAlertEventGets ¶
func (*HistoryAlertEvent) Add ¶
func (hae *HistoryAlertEvent) Add() error
func (*HistoryAlertEvent) FillObjs ¶
func (hae *HistoryAlertEvent) FillObjs() error
func (*HistoryAlertEvent) IsAlert ¶
func (hae *HistoryAlertEvent) IsAlert() bool
IsAlert 语法糖,避免直接拿IsRecovery字段做比对不直观易出错
func (*HistoryAlertEvent) IsRecov ¶
func (hae *HistoryAlertEvent) IsRecov() bool
IsRecov 语法糖,避免直接拿IsRecovery字段做比对不直观易出错
func (*HistoryAlertEvent) MarkAlert ¶
func (hae *HistoryAlertEvent) MarkAlert()
MarkAlert 语法糖,标记为告警状态
func (*HistoryAlertEvent) MarkMuted ¶
func (hae *HistoryAlertEvent) MarkMuted()
MarkMuted 语法糖,标记为屏蔽状态
func (*HistoryAlertEvent) MarkRecov ¶
func (hae *HistoryAlertEvent) MarkRecov()
MarkRecov 语法糖,标记为恢复状态
type LdapSection ¶
type LdapSection struct { Enable bool `yaml:"enable"` Host string `yaml:"host"` Port int `yaml:"port"` BaseDn string `yaml:"baseDn"` BindUser string `yaml:"bindUser"` BindPass string `yaml:"bindPass"` AuthFilter string `yaml:"authFilter"` Attributes ldapAttributes `yaml:"attributes"` CoverAttributes bool `yaml:"coverAttributes"` TLS bool `yaml:"tls"` StartTLS bool `yaml:"startTLS"` }
var LDAP LdapSection
type MetricDescription ¶
type MetricDescription struct { Id int64 `json:"id"` Metric string `json:"metric"` Description string `json:"description"` }
func MetricDescriptionGet ¶
func MetricDescriptionGet(where string, args ...interface{}) (*MetricDescription, error)
func MetricDescriptionGetAll ¶
func MetricDescriptionGetAll() ([]MetricDescription, error)
func MetricDescriptionGets ¶
func MetricDescriptionGets(query string, limit, offset int) ([]MetricDescription, error)
func (*MetricDescription) TableName ¶
func (md *MetricDescription) TableName() string
func (*MetricDescription) Update ¶
func (md *MetricDescription) Update(cols ...string) error
type Mute ¶
type Mute struct { Id int64 `json:"id"` ClasspathPrefix string `json:"classpath_prefix"` Metric string `json:"metric"` ResFilters string `json:"res_filters"` TagFilters string `json:"tags_filters"` Cause string `json:"cause"` Btime int64 `json:"btime"` Etime int64 `json:"etime"` CreateBy string `json:"create_by"` CreateAt int64 `json:"create_at"` ResRegexp *regexp.Regexp `xorm:"-" json:"-"` TagsMap map[string]string `xorm:"-" json:"-"` }
func MuteGetsAll ¶
type MysqlSection ¶
type MysqlSection struct { Addr string `yaml:"addr"` Max int `yaml:"max"` Idle int `yaml:"idle"` Debug bool `yaml:"debug"` }
var MySQL MysqlSection
type PortConfig ¶
type ProcConfig ¶
type PullExpression ¶
type PushExpression ¶
type ResFilter ¶
type ResFilter struct { Func string `json:"func"` // * InClasspath -> 可以内存里做个大map,host->classpath,然后看host对应的classpath中是否有某一个满足InClasspath的条件 // * NotInClasspath // * InClasspathPrefix -> 可以内存里做个大map,host->classpath,然后看host对应的classpath中是否有某一个满足InClasspathPrefix的条件 // * NotInClasspathPrefix // * InResourceList // * NotInResourceList // * HasPrefixString // * NoPrefixString // * HasSuffixString // * NoSuffixString // * ContainsString // * NotContainsString // * MatchRegexp // * NotMatchRegexp Params []string `json:"params"` }
type Resource ¶
type Resource struct { Id int64 `json:"id"` Ident string `json:"ident"` Alias string `json:"alias"` Tags string `json:"tags"` Note string `json:"note"` MuteBtime int64 `json:"mute_btime"` MuteEtime int64 `json:"mute_etime"` ClasspathIds []int64 `xorm:"-" json:"classpath_ids"` }
func ResourceGet ¶
func ResourceGetAll ¶
func ResourceGets ¶
ResourceGets query resource only
type Role ¶
func RoleGetsAll ¶
type RoleOperation ¶
func (RoleOperation) TableName ¶
func (RoleOperation) TableName() string
type ScriptConfig ¶
type User ¶
type User struct { Id int64 `json:"id"` Username string `json:"username"` Nickname string `json:"nickname"` Password string `json:"-"` Phone string `json:"phone"` Email string `json:"email"` Portrait string `json:"portrait"` Status int `json:"status"` RolesForDB string `json:"-" xorm:"'roles'"` // 这个字段写入数据库 RolesForFE []string `json:"roles" xorm:"-"` // 这个字段和前端交互 Contacts json.RawMessage `json:"contacts"` // 内容为 map[string]string 结构 CreateAt int64 `json:"create_at"` CreateBy string `json:"create_by"` UpdateAt int64 `json:"update_at"` UpdateBy string `json:"update_by"` }
func UserGetAll ¶
func UserGetById ¶
func UserGetByUsername ¶
func UserGetsByIds ¶
func UserGetsByIdsStr ¶
func (*User) ChangePassword ¶
func (*User) FavoriteAlertRuleGroupIds ¶
func (*User) FavoriteAlertRuleGroups ¶
func (u *User) FavoriteAlertRuleGroups() ([]AlertRuleGroup, error)
func (*User) FavoriteClasspathIds ¶
func (*User) FavoriteClasspaths ¶
func (*User) FavoriteDashboardIds ¶
func (*User) MyUserGroups ¶
func (*User) UserGroupIds ¶
UserGroupIds 我是成员的用户组ID列表
type UserGroup ¶
type UserGroup struct { Id int64 `json:"id"` Name string `json:"name"` Note string `json:"note"` CreateAt int64 `json:"create_at"` CreateBy string `json:"create_by"` UpdateAt int64 `json:"update_at"` UpdateBy string `json:"update_by"` }
func UserGroupGet ¶
func UserGroupGetAll ¶
func UserGroupGetsByIdsStr ¶
func (*UserGroup) AddMembers ¶
func (*UserGroup) DelMembers ¶
type UserGroupMember ¶
func UserGroupMemberGetAll ¶
func UserGroupMemberGetAll() ([]UserGroupMember, error)
func (UserGroupMember) TableName ¶
func (UserGroupMember) TableName() string
type UserToken ¶
type UserToken struct { UserId int64 `json:"user_id"` Username string `json:"username"` Token string `json:"token"` }
func UserTokenGet ¶
func UserTokenGets ¶
Source Files ¶
- alert_event.go
- alert_rule.go
- alert_rule_group.go
- alert_rule_group_favorite.go
- chart.go
- chart_group.go
- chart_tmp.go
- classpath.go
- classpath_favorite.go
- classpath_resource.go
- collect_rule.go
- configs.go
- dashboard.go
- dashboard_favorite.go
- funcs.go
- history_alert_event.go
- instance.go
- ldap.go
- metric_description.go
- mute.go
- mysql.go
- resource.go
- resource_updater.go
- role.go
- role_operation.go
- user.go
- user_group.go
- user_group_member.go
- user_token.go
Click to show internal directories.
Click to hide internal directories.