Documentation ¶
Index ¶
- Constants
- Variables
- func AlertAggrViewDel(ctx *ctx.Context, ids []int64, createBy ...interface{}) error
- func AlertCurEventDel(ctx *ctx.Context, ids []int64) error
- func AlertCurEventDelByHash(ctx *ctx.Context, hash string) error
- func AlertCurEventExists(ctx *ctx.Context, where string, args ...interface{}) (bool, error)
- func AlertCurEventGetMap(ctx *ctx.Context, cluster string) (map[int64]map[string]struct{}, error)
- func AlertCurEventStatistics(ctx *ctx.Context, stime time.Time) map[string]interface{}
- func AlertCurEventTotal(ctx *ctx.Context, prods []string, bgid, stime, etime int64, severity int, ...) (int64, error)
- func AlertCurEventUpgradeToV6(ctx *ctx.Context, dsm map[string]Datasource) error
- func AlertHisEventTotal(ctx *ctx.Context, prods []string, bgid, stime, etime int64, severity int, ...) (int64, error)
- func AlertHisEventUpgradeToV6(ctx *ctx.Context, dsm map[string]Datasource) error
- func AlertMuteDel(ctx *ctx.Context, ids []int64) error
- func AlertMuteUpgradeToV6(ctx *ctx.Context, dsm map[string]Datasource) error
- func AlertNumbers(ctx *ctx.Context, bgids []int64) (map[int64]int64, error)
- func AlertRuleDels(ctx *ctx.Context, ids []int64, bgid ...int64) error
- func AlertRuleExists(ctx *ctx.Context, id, groupId int64, datasourceIds []int64, name string) (bool, error)
- func AlertRuleGetName(ctx *ctx.Context, id int64) (string, error)
- func AlertRuleUpgradeToV6(ctx *ctx.Context, dsm map[string]Datasource) error
- func AlertSubscribeDel(ctx *ctx.Context, ids []int64) error
- func AlertSubscribeUpgradeToV6(ctx *ctx.Context, dsm map[string]Datasource) error
- func AlertingEngineAdd(ctx *ctx.Context, instance string, datasourceId int64) error
- func AlertingEngineDel(ctx *ctx.Context, ids []int64) error
- func AlertingEngineGetDatasourceIds(ctx *ctx.Context, instance string) ([]int64, error)
- func AlertingEngineGetsClusters(ctx *ctx.Context, where string, args ...interface{}) ([]string, error)
- func AlertingEngineGetsInstances(ctx *ctx.Context, where string, args ...interface{}) ([]string, error)
- func AlertingEngineHeartbeatWithCluster(ctx *ctx.Context, instance, cluster string, datasourceId int64) error
- func BoardCount(ctx *ctx.Context, where string, args ...interface{}) (num int64, err error)
- func BoardExists(ctx *ctx.Context, where string, args ...interface{}) (bool, error)
- func BoardPayloadGet(ctx *ctx.Context, id int64) (string, error)
- func BoardPayloadSave(ctx *ctx.Context, id int64, payload string) error
- func BoardSetHide(ctx *ctx.Context, ids []int64) error
- func BuiltinCateDelete(c *ctx.Context, name string, userId int64) error
- func BuiltinCateGetByUserId(c *ctx.Context, userId int64) (map[string]BuiltinCate, error)
- func BusiGroupAdd(ctx *ctx.Context, name string, labelEnable int, labelValue string, ...) error
- func BusiGroupExists(ctx *ctx.Context, where string, args ...interface{}) (bool, error)
- func BusiGroupGetMap(ctx *ctx.Context) (map[int64]*BusiGroup, error)
- func BusiGroupIds(ctx *ctx.Context, userGroupIds []int64, permFlag ...string) ([]int64, error)
- func BusiGroupMemberAdd(ctx *ctx.Context, member BusiGroupMember) error
- func BusiGroupMemberCount(ctx *ctx.Context, where string, args ...interface{}) (int64, error)
- func BusiGroupMemberDel(ctx *ctx.Context, where string, args ...interface{}) error
- func ChartGroupIdsOf(ctx *ctx.Context, dashId int64) ([]int64, error)
- func ConfigUserVariableGetDecryptMap(context *ctx.Context, privateKey []byte, passWord string) (map[string]string, error)
- func ConfigsDel(ctx *ctx.Context, ids []int64) error
- func ConfigsGet(ctx *ctx.Context, ckey string) (string, error)
- func ConfigsSet(ctx *ctx.Context, ckey, cval string) error
- func ConfigsSetWithUname(ctx *ctx.Context, ckey, cval, uName string) error
- func ConfigsUserVariableInsert(context *ctx.Context, conf Configs) error
- func ConfigsUserVariableUpdate(context *ctx.Context, conf Configs) error
- func Count(tx *gorm.DB) (int64, error)
- func CryptoPass(ctx *ctx.Context, raw string) (string, error)
- func DB(ctx *ctx.Context) *gorm.DB
- func DashboardCount(ctx *ctx.Context, where string, args ...interface{}) (num int64, err error)
- func DashboardExists(ctx *ctx.Context, where string, args ...interface{}) (bool, error)
- func DatasourceDel(ctx *ctx.Context, ids []int64) error
- func DatasourceGetMap(ctx *ctx.Context) (map[int64]*Datasource, error)
- func EsIndexPatternDel(ctx *ctx.Context, ids []int64) error
- func EsIndexPatternExists(ctx *ctx.Context, id, datasourceId int64, name string) (bool, error)
- func EventPersist(ctx *ctx.Context, event *AlertCurEvent) error
- func Exists(tx *gorm.DB) (bool, error)
- func GetDatasourceIdsByEngineName(ctx *ctx.Context, engineName string) ([]int64, error)
- func GetDatasourcesCountBy(ctx *ctx.Context, typ, cate, name string) (int64, error)
- func GetDatasourcesCountByName(ctx *ctx.Context, name string) (int64, error)
- func GetDatasourcesGetsByTypes(ctx *ctx.Context, typs []string) (map[string]*Datasource, error)
- func GetHostsQuery(queries []HostQuery) []map[string]interface{}
- func IdentsFilter(ctx *ctx.Context, idents []string, where string, args ...interface{}) ([]string, error)
- func InitNotifyConfig(c *ctx.Context, tplDir string)
- func InitRSAPassWord(ctx *ctx.Context) (string, error)
- func InitRoot(ctx *ctx.Context)
- func InitSalt(ctx *ctx.Context)
- func Insert(ctx *ctx.Context, obj interface{}) error
- func IsAllDatasource(datasourceIds []int64) bool
- func LabelAndKeyHasKey(keys []LabelAndKey, key string) bool
- func ListTpls(c *ctx.Context) (map[string]*template.Template, error)
- func MatchDatasource(ids []int64, id int64) bool
- func MemberIds(ctx *ctx.Context, groupId int64) ([]int64, error)
- func MetricViewDel(ctx *ctx.Context, ids []int64, createBy ...interface{}) error
- func MissTargetCountByFilter(ctx *ctx.Context, query []map[string]interface{}, ts int64) (int64, error)
- func MyGroupIds(ctx *ctx.Context, userId int64) ([]int64, error)
- func NewDefaultChartGroup(ctx *ctx.Context, dashId int64) error
- func NotifyTplCountByChannel(c *ctx.Context, channel string) (int64, error)
- func OperationsOfRole(ctx *ctx.Context, roles []string) ([]string, error)
- func ParseInt64(values []interface{}) []int64
- func RecordingRuleDels(ctx *ctx.Context, ids []int64, groupId int64) error
- func RecordingRuleUpgradeToV6(ctx *ctx.Context, dsm map[string]Datasource) error
- func RoleCount(ctx *ctx.Context, where string, args ...interface{}) (num int64, err error)
- func RoleHasOperation(ctx *ctx.Context, roles []string, operation string) (bool, error)
- func RoleOperationBind(ctx *ctx.Context, roleName string, operation []string) error
- func SsoConfigCountByName(c *ctx.Context, name string) (int64, error)
- func Str2Int(arr []string) []int64
- func TargetCountByFilter(ctx *ctx.Context, query []map[string]interface{}) (int64, error)
- func TargetDel(ctx *ctx.Context, idents []string) error
- func TargetFilterQueryBuild(ctx *ctx.Context, query []map[string]interface{}, limit, offset int) *gorm.DB
- func TargetGetTags(ctx *ctx.Context, idents []string) ([]string, error)
- func TargetIdents(ctx *ctx.Context, ids []int64) ([]string, error)
- func TargetIds(ctx *ctx.Context, idents []string) ([]int64, error)
- func TargetTotal(ctx *ctx.Context, bgids []int64, dsIds []int64, query string, downtime int64) (int64, error)
- func TargetTotalCount(ctx *ctx.Context) (int64, error)
- func TargetUpdateBgid(ctx *ctx.Context, idents []string, bgid int64, clearTags bool) error
- func TargetUpdateNote(ctx *ctx.Context, idents []string, note string) error
- func TaskRecordTotal(ctx *ctx.Context, bgids []int64, beginTime int64, createBy, query string) (int64, error)
- func TaskTplTotal(ctx *ctx.Context, groupIds []int64, query string) (int64, error)
- func UserGroupCount(ctx *ctx.Context, where string, args ...interface{}) (num int64, err error)
- func UserGroupIdsOfBusiGroup(ctx *ctx.Context, busiGroupId int64, permFlag ...string) ([]int64, error)
- func UserGroupMemberAdd(ctx *ctx.Context, groupId, userId int64) error
- func UserGroupMemberCount(ctx *ctx.Context, where string, args ...interface{}) (int64, error)
- func UserGroupMemberDel(ctx *ctx.Context, groupId int64, userIds []int64) error
- func UserTotal(ctx *ctx.Context, query string) (num int64, err error)
- func WrapExtendIdent(ident string) string
- func WrapIdent(ident string) string
- type AggrRule
- type AlertAggrView
- type AlertCurEvent
- func AlertCurEventGet(ctx *ctx.Context, where string, args ...interface{}) (*AlertCurEvent, error)
- func AlertCurEventGetById(ctx *ctx.Context, id int64) (*AlertCurEvent, error)
- func AlertCurEventGetByIds(ctx *ctx.Context, ids []int64) ([]*AlertCurEvent, error)
- func AlertCurEventGetByRuleIdAndDsId(ctx *ctx.Context, ruleId int64, datasourceId int64) ([]*AlertCurEvent, error)
- func AlertCurEventGets(ctx *ctx.Context, prods []string, bgid, stime, etime int64, severity int, ...) ([]AlertCurEvent, error)
- func AlertCurEventGetsFromAlertMute(ctx *ctx.Context, alertMute *AlertMute) ([]*AlertCurEvent, error)
- func (e *AlertCurEvent) Add(ctx *ctx.Context) error
- func (e *AlertCurEvent) DB2FE() error
- func (e *AlertCurEvent) DB2Mem()
- func (e *AlertCurEvent) FE2DB()
- func (e *AlertCurEvent) FillNotifyGroups(ctx *ctx.Context, cache map[int64]*UserGroup) error
- func (e *AlertCurEvent) GenCardTitle(rules []*AggrRule) string
- func (e *AlertCurEvent) GetField(field string) string
- func (e *AlertCurEvent) GetTagValue(tagkey string) string
- func (e *AlertCurEvent) ParseRule(field string) error
- func (e *AlertCurEvent) TableName() string
- func (e *AlertCurEvent) ToHis(ctx *ctx.Context) *AlertHisEvent
- func (m *AlertCurEvent) UpdateFieldsMap(ctx *ctx.Context, fields map[string]interface{}) error
- type AlertHisEvent
- func AlertHisEventGet(ctx *ctx.Context, where string, args ...interface{}) (*AlertHisEvent, error)
- func AlertHisEventGetById(ctx *ctx.Context, id int64) (*AlertHisEvent, error)
- func AlertHisEventGets(ctx *ctx.Context, prods []string, bgid, stime, etime int64, severity int, ...) ([]AlertHisEvent, error)
- func (e *AlertHisEvent) Add(ctx *ctx.Context) error
- func (e *AlertHisEvent) DB2FE()
- func (e *AlertHisEvent) FillNotifyGroups(ctx *ctx.Context, cache map[int64]*UserGroup) error
- func (e *AlertHisEvent) TableName() string
- func (m *AlertHisEvent) UpdateFieldsMap(ctx *ctx.Context, fields map[string]interface{}) error
- type AlertMute
- func AlertMuteGet(ctx *ctx.Context, where string, args ...interface{}) (*AlertMute, error)
- func AlertMuteGetById(ctx *ctx.Context, id int64) (*AlertMute, error)
- func AlertMuteGets(ctx *ctx.Context, prods []string, bgid int64, query string) (lst []AlertMute, err error)
- func AlertMuteGetsAll(ctx *ctx.Context) ([]*AlertMute, error)
- func AlertMuteGetsByBG(ctx *ctx.Context, groupId int64) (lst []AlertMute, err error)
- func AlertMuteGetsByBGIds(ctx *ctx.Context, bgIds []int64) (lst []AlertMute, err error)
- func (m *AlertMute) Add(ctx *ctx.Context) error
- func (m *AlertMute) DB2FE() error
- func (m *AlertMute) FE2DB() error
- func (m *AlertMute) Parse() error
- func (m *AlertMute) TableName() string
- func (m *AlertMute) Update(ctx *ctx.Context, arm AlertMute) error
- func (m *AlertMute) UpdateFieldsMap(ctx *ctx.Context, fields map[string]interface{}) error
- func (m *AlertMute) Verify() error
- type AlertNumber
- type AlertRule
- func AlertRuleGet(ctx *ctx.Context, where string, args ...interface{}) (*AlertRule, error)
- func AlertRuleGetById(ctx *ctx.Context, id int64) (*AlertRule, error)
- func AlertRuleGets(ctx *ctx.Context, groupId int64) ([]AlertRule, error)
- func AlertRuleGetsAll(ctx *ctx.Context) ([]*AlertRule, error)
- func AlertRuleGetsByBGIds(ctx *ctx.Context, bgids []int64) ([]AlertRule, error)
- func AlertRulesGetsBy(ctx *ctx.Context, prods []string, query, algorithm, cluster string, ...) ([]*AlertRule, error)
- func (ar *AlertRule) Add(ctx *ctx.Context) error
- func (ar *AlertRule) DB2FE() error
- func (ar *AlertRule) FE2DB() error
- func (ar *AlertRule) FillDatasourceIds() error
- func (ar *AlertRule) FillNotifyGroups(ctx *ctx.Context, cache map[int64]*UserGroup) error
- func (ar *AlertRule) FillSeverities() error
- func (ar *AlertRule) GenerateNewEvent(ctx *ctx.Context) *AlertCurEvent
- func (ar *AlertRule) GetRuleType() string
- func (ar *AlertRule) IsHostRule() bool
- func (ar *AlertRule) IsLokiRule() bool
- func (ar *AlertRule) IsPrometheusRule() bool
- func (ar *AlertRule) IsTdengineRule() bool
- func (ar *AlertRule) TableName() string
- func (ar *AlertRule) Update(ctx *ctx.Context, arf AlertRule) error
- func (ar *AlertRule) UpdateColumn(ctx *ctx.Context, column string, value interface{}) error
- func (ar *AlertRule) UpdateEvent(event *AlertCurEvent)
- func (ar *AlertRule) UpdateFieldsMap(ctx *ctx.Context, fields map[string]interface{}) error
- func (ar *AlertRule) Verify() error
- type AlertSubscribe
- func AlertSubscribeGet(ctx *ctx.Context, where string, args ...interface{}) (*AlertSubscribe, error)
- func AlertSubscribeGets(ctx *ctx.Context, groupId int64) (lst []AlertSubscribe, err error)
- func AlertSubscribeGetsAll(ctx *ctx.Context) ([]*AlertSubscribe, error)
- func AlertSubscribeGetsByBGIds(ctx *ctx.Context, bgIds []int64) (lst []AlertSubscribe, err error)
- func AlertSubscribeGetsByService(ctx *ctx.Context) (lst []AlertSubscribe, err error)
- func (s *AlertSubscribe) Add(ctx *ctx.Context) error
- func (s *AlertSubscribe) DB2FE() error
- func (s *AlertSubscribe) FE2DB() error
- func (s *AlertSubscribe) FillDatasourceIds(ctx *ctx.Context) error
- func (s *AlertSubscribe) FillRuleName(ctx *ctx.Context, cache map[int64]string) error
- func (s *AlertSubscribe) FillUserGroups(ctx *ctx.Context, cache map[int64]*UserGroup) error
- func (s *AlertSubscribe) IsDisabled() bool
- func (s *AlertSubscribe) MatchCluster(dsId int64) bool
- func (s *AlertSubscribe) MatchProd(prod string) bool
- func (s *AlertSubscribe) ModifyEvent(event *AlertCurEvent)
- func (s *AlertSubscribe) Parse() error
- func (s *AlertSubscribe) TableName() string
- func (s *AlertSubscribe) Update(ctx *ctx.Context, selectField interface{}, selectFields ...interface{}) error
- func (s *AlertSubscribe) UpdateFieldsMap(ctx *ctx.Context, fields map[string]interface{}) error
- func (s *AlertSubscribe) Verify() error
- type AlertingEngines
- type Auth
- type Board
- func BoardGet(ctx *ctx.Context, where string, args ...interface{}) (*Board, error)
- func BoardGetByID(ctx *ctx.Context, id int64) (*Board, error)
- func BoardGets(ctx *ctx.Context, query, where string, args ...interface{}) ([]Board, error)
- func BoardGetsByBGIds(ctx *ctx.Context, gids []int64, query string) ([]Board, error)
- func BoardGetsByGroupId(ctx *ctx.Context, groupId int64, query string) ([]Board, error)
- func (b *Board) Add(ctx *ctx.Context) error
- func (b *Board) CanRenameIdent(ctx *ctx.Context, ident string) (bool, error)
- func (b *Board) DB2FE() error
- func (b *Board) Del(ctx *ctx.Context) error
- func (b *Board) TableName() string
- func (b *Board) Update(ctx *ctx.Context, selectField interface{}, selectFields ...interface{}) error
- func (b *Board) Verify() error
- type BoardPayload
- type BuiltinCate
- type BusiGroup
- func (bg *BusiGroup) AddMembers(ctx *ctx.Context, members []BusiGroupMember, username string) error
- func (bg *BusiGroup) DB2FE() error
- func (bg *BusiGroup) Del(ctx *ctx.Context) error
- func (bg *BusiGroup) DelMembers(ctx *ctx.Context, members []BusiGroupMember, username string) error
- func (bg *BusiGroup) FillUserGroups(ctx *ctx.Context) error
- func (bg *BusiGroup) TableName() string
- func (bg *BusiGroup) Update(ctx *ctx.Context, name string, labelEnable int, labelValue string, ...) error
- type BusiGroupMember
- func BusiGroupMemberGet(ctx *ctx.Context, where string, args ...interface{}) (*BusiGroupMember, error)
- func BusiGroupMemberGets(ctx *ctx.Context, where string, args ...interface{}) ([]BusiGroupMember, error)
- func BusiGroupMemberGetsByBusiGroupId(ctx *ctx.Context, busiGroupId int64) ([]BusiGroupMember, error)
- type Chart
- type ChartGroup
- type ChartShare
- type Configs
- type Dashboard
- func DashboardGet(ctx *ctx.Context, where string, args ...interface{}) (*Dashboard, error)
- func DashboardGetAll(ctx *ctx.Context) ([]Dashboard, error)
- func DashboardGets(ctx *ctx.Context, groupId int64, query string) ([]Dashboard, error)
- func DashboardGetsByIds(ctx *ctx.Context, ids []int64) ([]Dashboard, error)
- type DataResp
- type Datasource
- func (ds *Datasource) Add(ctx *ctx.Context) error
- func (ds *Datasource) DB2FE() error
- func (ds *Datasource) FE2DB() error
- func (ds *Datasource) Get(ctx *ctx.Context) error
- func (ds *Datasource) TableName() string
- func (ds *Datasource) Update(ctx *ctx.Context, selectField interface{}, selectFields ...interface{}) error
- func (ds *Datasource) Verify() error
- type EsIndexPattern
- type HTTP
- type HeartbeatInfo
- type HostMeta
- type HostQuery
- type HostRuleConfig
- type HostTrigger
- type LabelAndKey
- type MetricView
- type NotifyChannel
- type NotifyContact
- type NotifyScript
- type NotifyTpl
- func (n *NotifyTpl) Create(c *ctx.Context) error
- func (n *NotifyTpl) CreateIfNotExists(c *ctx.Context, channel string) error
- func (n *NotifyTpl) DB2FE() error
- func (n *NotifyTpl) NotifyTplDelete(ctx *ctx.Context, id int64) error
- func (n *NotifyTpl) TableName() string
- func (n *NotifyTpl) Update(c *ctx.Context) error
- func (n *NotifyTpl) UpdateContent(c *ctx.Context) error
- type PeriodicMute
- type PromQuery
- type PromRuleConfig
- type Query
- type QueryConfig
- type QueryParam
- type RecordingRule
- func RecordingRuleEnabledGets(ctx *ctx.Context) ([]*RecordingRule, error)
- func RecordingRuleGet(ctx *ctx.Context, where string, regs ...interface{}) (*RecordingRule, error)
- func RecordingRuleGetById(ctx *ctx.Context, id int64) (*RecordingRule, error)
- func RecordingRuleGets(ctx *ctx.Context, groupId int64) ([]RecordingRule, error)
- func RecordingRuleGetsByBGIds(ctx *ctx.Context, bgIds []int64) ([]RecordingRule, error)
- func RecordingRuleGetsByCluster(ctx *ctx.Context) ([]*RecordingRule, error)
- func (re *RecordingRule) Add(ctx *ctx.Context) error
- func (re *RecordingRule) DB2FE() error
- func (re *RecordingRule) FE2DB()
- func (re *RecordingRule) TableName() string
- func (re *RecordingRule) Update(ctx *ctx.Context, ref RecordingRule) error
- func (re *RecordingRule) UpdateFieldsMap(ctx *ctx.Context, fields map[string]interface{}) error
- func (re *RecordingRule) Verify() error
- type RelationKey
- type Role
- type RoleOperation
- type RuleQuery
- type Series
- type SsoConfig
- type Statistics
- func AlertMuteStatistics(ctx *ctx.Context) (*Statistics, error)
- func AlertRuleStatistics(ctx *ctx.Context) (*Statistics, error)
- func AlertSubscribeStatistics(ctx *ctx.Context) (*Statistics, error)
- func BusiGroupStatistics(ctx *ctx.Context) (*Statistics, error)
- func ConfigsUserVariableStatistics(context *ctx.Context) (*Statistics, error)
- func DatasourceStatistics(ctx *ctx.Context) (*Statistics, error)
- func RecordingRuleStatistics(ctx *ctx.Context) (*Statistics, error)
- func StatisticsGet[T any](ctx *ctx.Context, model T) (*Statistics, error)
- func TargetStatistics(ctx *ctx.Context) (*Statistics, error)
- func UserGroupStatistics(ctx *ctx.Context) (*Statistics, error)
- func UserStatistics(ctx *ctx.Context) (*Statistics, error)
- type TLS
- type TagFilter
- type Target
- func MissTargetGetsByFilter(ctx *ctx.Context, query []map[string]interface{}, ts int64) ([]*Target, error)
- func TargetGet(ctx *ctx.Context, where string, args ...interface{}) (*Target, error)
- func TargetGetById(ctx *ctx.Context, id int64) (*Target, error)
- func TargetGetByIdent(ctx *ctx.Context, ident string) (*Target, error)
- func TargetGets(ctx *ctx.Context, bgids []int64, dsIds []int64, query string, downtime int64, ...) ([]*Target, error)
- func TargetGetsAll(ctx *ctx.Context) ([]*Target, error)
- func TargetGetsByFilter(ctx *ctx.Context, query []map[string]interface{}, limit, offset int) ([]*Target, error)
- func (t *Target) AddTags(ctx *ctx.Context, tags []string) error
- func (t *Target) DB2FE() error
- func (t *Target) DelTags(ctx *ctx.Context, tags []string) error
- func (t *Target) FillGroup(ctx *ctx.Context, cache map[int64]*BusiGroup) error
- func (t *Target) FillMeta(meta *HostMeta)
- func (t *Target) FillTagsMap()
- func (t *Target) GetTagsMap() map[string]string
- func (t *Target) TableName() string
- func (m *Target) UpdateFieldsMap(ctx *ctx.Context, fields map[string]interface{}) error
- type TaskRecord
- type TaskTpl
- func (t *TaskTpl) AddTags(ctx *ctx.Context, tags []string, updateBy string) error
- func (t *TaskTpl) CleanFields() error
- func (t *TaskTpl) DB2FE() error
- func (t *TaskTpl) Del(ctx *ctx.Context) error
- func (t *TaskTpl) DelTags(ctx *ctx.Context, tags []string, updateBy string) error
- func (t *TaskTpl) Hosts(ctx *ctx.Context) ([]string, error)
- func (t *TaskTpl) Save(ctx *ctx.Context, hosts []string) error
- func (t *TaskTpl) TableName() string
- func (t *TaskTpl) Update(ctx *ctx.Context, hosts []string) error
- func (t *TaskTpl) UpdateGroup(ctx *ctx.Context, groupId int64, updateBy string) error
- type Trigger
- type User
- func LdapLogin(ctx *ctx.Context, username, pass, roles string, ldap *ldapx.SsoClient) (*User, error)
- func PassLogin(ctx *ctx.Context, username, pass string) (*User, error)
- func UserGet(ctx *ctx.Context, where string, args ...interface{}) (*User, error)
- func UserGetAll(ctx *ctx.Context) ([]*User, error)
- func UserGetById(ctx *ctx.Context, id int64) (*User, error)
- func UserGetByUsername(ctx *ctx.Context, username string) (*User, error)
- func UserGets(ctx *ctx.Context, query string, limit, offset int) ([]User, error)
- func UserGetsByIds(ctx *ctx.Context, ids []int64) ([]User, error)
- func (u *User) Add(ctx *ctx.Context) error
- func (u *User) BusiGroups(ctx *ctx.Context, limit int, query string, all ...bool) ([]BusiGroup, error)
- func (u *User) CanDoBusiGroup(ctx *ctx.Context, bg *BusiGroup, permFlag ...string) (bool, error)
- func (u *User) CanModifyUserGroup(ctx *ctx.Context, ug *UserGroup) (bool, error)
- func (u *User) ChangePassword(ctx *ctx.Context, oldpass, newpass string) error
- func (u *User) CheckPerm(ctx *ctx.Context, operation string) (bool, error)
- func (u *User) DB2FE() error
- func (u *User) Del(ctx *ctx.Context) error
- func (u *User) ExtractToken(key string) (string, bool)
- func (u *User) IsAdmin() bool
- func (u *User) NopriIdents(ctx *ctx.Context, idents []string) ([]string, error)
- func (u *User) String() string
- func (u *User) TableName() string
- func (u *User) Update(ctx *ctx.Context, selectField interface{}, selectFields ...interface{}) error
- func (u *User) UpdateAllFields(ctx *ctx.Context) error
- func (u *User) UpdatePassword(ctx *ctx.Context, password, updateBy string) error
- func (u *User) UserGroups(ctx *ctx.Context, limit int, query string) ([]UserGroup, error)
- func (u *User) Verify() error
- type UserGroup
- func (ug *UserGroup) Add(ctx *ctx.Context) error
- func (ug *UserGroup) AddMembers(ctx *ctx.Context, userIds []int64) error
- func (ug *UserGroup) DB2FE() error
- func (ug *UserGroup) Del(ctx *ctx.Context) error
- func (ug *UserGroup) DelMembers(ctx *ctx.Context, userIds []int64) error
- func (ug *UserGroup) TableName() string
- func (ug *UserGroup) Update(ctx *ctx.Context, selectField interface{}, selectFields ...interface{}) error
- func (ug *UserGroup) Verify() error
- type UserGroupMember
- type UserGroupWithPermFlag
- type Webhook
Constants ¶
const ( METRIC = "metric" LOG = "logging" HOST = "host" LOKI = "loki" PROMETHEUS = "prometheus" TDENGINE = "tdengine" )
const ( SALT = "salt" RSA_PRIVATE_KEY = "rsa_private_key" RSA_PUBLIC_KEY = "rsa_public_key" RSA_PASSWORD = "rsa_password" )
const ( Dingtalk = "dingtalk" Wecom = "wecom" Feishu = "feishu" FeishuCard = "feishucard" Mm = "mm" Telegram = "telegram" Email = "email" EmailSubject = "mailsubject" DingtalkKey = "dingtalk_robot_token" WecomKey = "wecom_robot_token" FeishuKey = "feishu_robot_token" MmKey = "mm_webhook_url" TelegramKey = "telegram_robot_token" )
const AdminRole = "Admin"
const DatasourceIdAll = 0
if rule's cluster field contains `ClusterAll`, means it take effect in all clusters
const IBEX = "ibex_server"
const NOTIFYCHANNEL = "notify_channel"
const NOTIFYCONTACT = "notify_contact"
const NOTIFYSCRIPT = "notify_script"
const Periodic int = 1
const SMTP = "smtp_config"
const TimeRange int = 0
const WEBHOOKKEY = "webhook"
Variables ¶
var ( ConfigExternal = 1 //external type ConfigEncrypted = 1 //ciphertext )
var (
DefaultChannels = []string{Dingtalk, Wecom, Feishu, Mm, Telegram, Email, FeishuCard}
)
var TplMap = map[string]string{
Dingtalk: `#### {{if .IsRecovered}}<font color="#008800">S{{.Severity}} - Recovered - {{.RuleName}}</font>{{else}}<font color="#FF0000">S{{.Severity}} - Triggered - {{.RuleName}}</font>{{end}}
---
- **规则标题**: {{.RuleName}}{{if .RuleNote}}
- **规则备注**: {{.RuleNote}}{{end}}
{{if not .IsRecovered}}- **触发时值**: {{.TriggerValue}}{{end}}
{{if .TargetIdent}}- **监控对象**: {{.TargetIdent}}{{end}}
- **监控指标**: {{.TagsJSON}}
- {{if .IsRecovered}}**恢复时间**: {{timeformat .LastEvalTime}}{{else}}**触发时间**: {{timeformat .TriggerTime}}{{end}}
- **发送时间**: {{timestamp}}
`,
Email: `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>夜莺告警通知</title>
<style type="text/css">
.wrapper {
background-color: #f8f8f8;
padding: 15px;
height: 100%;
}
.main {
width: 600px;
padding: 30px;
margin: 0 auto;
background-color: #fff;
font-size: 12px;
font-family: verdana,'Microsoft YaHei',Consolas,'Deja Vu Sans Mono','Bitstream Vera Sans Mono';
}
header {
border-radius: 2px 2px 0 0;
}
header .title {
font-size: 14px;
color: #333333;
margin: 0;
}
header .sub-desc {
color: #333;
font-size: 14px;
margin-top: 6px;
margin-bottom: 0;
}
hr {
margin: 20px 0;
height: 0;
border: none;
border-top: 1px solid #e5e5e5;
}
em {
font-weight: 600;
}
table {
margin: 20px 0;
width: 100%;
}
table tbody tr{
font-weight: 200;
font-size: 12px;
color: #666;
height: 32px;
}
.succ {
background-color: green;
color: #fff;
}
.fail {
background-color: red;
color: #fff;
}
.succ th, .succ td, .fail th, .fail td {
color: #fff;
}
table tbody tr th {
width: 80px;
text-align: right;
}
.text-right {
text-align: right;
}
.body {
margin-top: 24px;
}
.body-text {
color: #666666;
-webkit-font-smoothing: antialiased;
}
.body-extra {
-webkit-font-smoothing: antialiased;
}
.body-extra.text-right a {
text-decoration: none;
color: #333;
}
.body-extra.text-right a:hover {
color: #666;
}
.button {
width: 200px;
height: 50px;
margin-top: 20px;
text-align: center;
border-radius: 2px;
background: #2D77EE;
line-height: 50px;
font-size: 20px;
color: #FFFFFF;
cursor: pointer;
}
.button:hover {
background: rgb(25, 115, 255);
border-color: rgb(25, 115, 255);
color: #fff;
}
footer {
margin-top: 10px;
text-align: right;
}
.footer-logo {
text-align: right;
}
.footer-logo-image {
width: 108px;
height: 27px;
margin-right: 10px;
}
.copyright {
margin-top: 10px;
font-size: 12px;
text-align: right;
color: #999;
-webkit-font-smoothing: antialiased;
}
</style>
</head>
<body>
<div class="wrapper">
<div class="main">
<header>
<h3 class="title">{{.RuleName}}</h3>
<p class="sub-desc"></p>
</header>
<hr>
<div class="body">
<table cellspacing="0" cellpadding="0" border="0">
<tbody>
{{if .IsRecovered}}
<tr class="succ">
<th>级别状态:</th>
<td>S{{.Severity}} Recovered</td>
</tr>
{{else}}
<tr class="fail">
<th>级别状态:</th>
<td>S{{.Severity}} Triggered</td>
</tr>
{{end}}
<tr>
<th>策略备注:</th>
<td>{{.RuleNote}}</td>
</tr>
<tr>
<th>设备备注:</th>
<td>{{.TargetNote}}</td>
</tr>
{{if not .IsRecovered}}
<tr>
<th>触发时值:</th>
<td>{{.TriggerValue}}</td>
</tr>
{{end}}
{{if .TargetIdent}}
<tr>
<th>监控对象:</th>
<td>{{.TargetIdent}}</td>
</tr>
{{end}}
<tr>
<th>监控指标:</th>
<td>{{.TagsJSON}}</td>
</tr>
{{if .IsRecovered}}
<tr>
<th>恢复时间:</th>
<td>{{timeformat .LastEvalTime}}</td>
</tr>
{{else}}
<tr>
<th>触发时间:</th>
<td>
{{timeformat .TriggerTime}}
</td>
</tr>
{{end}}
<tr>
<th>发送时间:</th>
<td>
{{timestamp}}
</td>
</tr>
</tbody>
</table>
<hr>
<footer>
<div class="copyright" style="font-style: italic">
报警太多?使用 <a href="https://flashcat.cloud/product/flashduty/" target="_blank">FlashDuty</a> 做告警聚合降噪、排班OnCall!
</div>
</footer>
</div>
</div>
</div>
</body>
</html>`,
Feishu: `级别状态: S{{.Severity}} {{if .IsRecovered}}Recovered{{else}}Triggered{{end}}
规则名称: {{.RuleName}}{{if .RuleNote}}
规则备注: {{.RuleNote}}{{end}}
监控指标: {{.TagsJSON}}
{{if .IsRecovered}}恢复时间:{{timeformat .LastEvalTime}}{{else}}触发时间: {{timeformat .TriggerTime}}
触发时值: {{.TriggerValue}}{{end}}
发送时间: {{timestamp}}`,
FeishuCard: `{{ if .IsRecovered }}
{{- if ne .Cate "host"}}
**告警集群:** {{.Cluster}}{{end}}
**级别状态:** S{{.Severity}} Recovered
**告警名称:** {{.RuleName}}
**恢复时间:** {{timeformat .LastEvalTime}}
**告警描述:** **服务已恢复**
{{- else }}
{{- if ne .Cate "host"}}
**告警集群:** {{.Cluster}}{{end}}
**级别状态:** S{{.Severity}} Triggered
**告警名称:** {{.RuleName}}
**触发时间:** {{timeformat .TriggerTime}}
**发送时间:** {{timestamp}}
**触发时值:** {{.TriggerValue}}
{{if .RuleNote }}**告警描述:** **{{.RuleNote}}**{{end}}
{{- end -}}`,
EmailSubject: `{{if .IsRecovered}}Recovered{{else}}Triggered{{end}}: {{.RuleName}} {{.TagsJSON}}`,
Mm: `级别状态: S{{.Severity}} {{if .IsRecovered}}Recovered{{else}}Triggered{{end}}
规则名称: {{.RuleName}}{{if .RuleNote}}
规则备注: {{.RuleNote}}{{end}}
监控指标: {{.TagsJSON}}
{{if .IsRecovered}}恢复时间:{{timeformat .LastEvalTime}}{{else}}触发时间: {{timeformat .TriggerTime}}
触发时值: {{.TriggerValue}}{{end}}
发送时间: {{timestamp}}`,
Telegram: `**级别状态**: {{if .IsRecovered}}<font color="info">S{{.Severity}} Recovered</font>{{else}}<font color="warning">S{{.Severity}} Triggered</font>{{end}}
**规则标题**: {{.RuleName}}{{if .RuleNote}}
**规则备注**: {{.RuleNote}}{{end}}{{if .TargetIdent}}
**监控对象**: {{.TargetIdent}}{{end}}
**监控指标**: {{.TagsJSON}}{{if not .IsRecovered}}
**触发时值**: {{.TriggerValue}}{{end}}
{{if .IsRecovered}}**恢复时间**: {{timeformat .LastEvalTime}}{{else}}**首次触发时间**: {{timeformat .FirstTriggerTime}}{{end}}
{{$time_duration := sub now.Unix .FirstTriggerTime }}{{if .IsRecovered}}{{$time_duration = sub .LastEvalTime .FirstTriggerTime }}{{end}}**距离首次告警**: {{humanizeDurationInterface $time_duration}}
**发送时间**: {{timestamp}}`,
Wecom: `**级别状态**: {{if .IsRecovered}}<font color="info">S{{.Severity}} Recovered</font>{{else}}<font color="warning">S{{.Severity}} Triggered</font>{{end}}
**规则标题**: {{.RuleName}}{{if .RuleNote}}
**规则备注**: {{.RuleNote}}{{end}}{{if .TargetIdent}}
**监控对象**: {{.TargetIdent}}{{end}}
**监控指标**: {{.TagsJSON}}{{if not .IsRecovered}}
**触发时值**: {{.TriggerValue}}{{end}}
{{if .IsRecovered}}**恢复时间**: {{timeformat .LastEvalTime}}{{else}}**首次触发时间**: {{timeformat .FirstTriggerTime}}{{end}}
{{$time_duration := sub now.Unix .FirstTriggerTime }}{{if .IsRecovered}}{{$time_duration = sub .LastEvalTime .FirstTriggerTime }}{{end}}**距离首次告警**: {{humanizeDurationInterface $time_duration}}
**发送时间**: {{timestamp}}`,
}
Functions ¶
func AlertAggrViewDel ¶
AlertAggrViewDel: userid for safe delete
func AlertCurEventExists ¶
func AlertCurEventGetMap ¶
func AlertCurEventStatistics ¶ added in v6.2.0
func AlertCurEventTotal ¶
func AlertCurEventUpgradeToV6 ¶
func AlertCurEventUpgradeToV6(ctx *ctx.Context, dsm map[string]Datasource) error
func AlertHisEventTotal ¶
func AlertHisEventUpgradeToV6 ¶
func AlertHisEventUpgradeToV6(ctx *ctx.Context, dsm map[string]Datasource) error
func AlertMuteUpgradeToV6 ¶
func AlertMuteUpgradeToV6(ctx *ctx.Context, dsm map[string]Datasource) error
func AlertNumbers ¶
for busi_group list page
func AlertRuleExists ¶
func AlertRuleUpgradeToV6 ¶
func AlertRuleUpgradeToV6(ctx *ctx.Context, dsm map[string]Datasource) error
func AlertSubscribeUpgradeToV6 ¶
func AlertSubscribeUpgradeToV6(ctx *ctx.Context, dsm map[string]Datasource) error
func AlertingEngineAdd ¶
func BoardCount ¶
func BoardExists ¶
func BuiltinCateDelete ¶
删除 builtin_cate
func BuiltinCateGetByUserId ¶
根据 userId 获取 builtin_cate
func BusiGroupAdd ¶
func BusiGroupExists ¶
func BusiGroupIds ¶
func BusiGroupMemberAdd ¶
func BusiGroupMemberAdd(ctx *ctx.Context, member BusiGroupMember) error
func BusiGroupMemberCount ¶
func BusiGroupMemberDel ¶
func ConfigUserVariableGetDecryptMap ¶ added in v6.4.0
func ConfigsSetWithUname ¶ added in v6.4.0
func ConfigsUserVariableInsert ¶ added in v6.3.0
func ConfigsUserVariableUpdate ¶ added in v6.3.0
func CryptoPass ¶
CryptoPass crypto password use salt
func DashboardCount ¶
func DashboardExists ¶
func DatasourceGetMap ¶
func DatasourceGetMap(ctx *ctx.Context) (map[int64]*Datasource, error)
func EsIndexPatternExists ¶
func EventPersist ¶
func EventPersist(ctx *ctx.Context, event *AlertCurEvent) error
func GetDatasourcesCountBy ¶
func GetHostsQuery ¶
func IdentsFilter ¶
func InitNotifyConfig ¶
func IsAllDatasource ¶
func LabelAndKeyHasKey ¶
func LabelAndKeyHasKey(keys []LabelAndKey, key string) bool
func MatchDatasource ¶
func MetricViewDel ¶
MetricViewDel: userid for safe delete
func MissTargetCountByFilter ¶
func NotifyTplCountByChannel ¶
func ParseInt64 ¶
func ParseInt64(values []interface{}) []int64
func RecordingRuleUpgradeToV6 ¶
func RecordingRuleUpgradeToV6(ctx *ctx.Context, dsm map[string]Datasource) error
func RoleHasOperation ¶
func RoleOperationBind ¶
func SsoConfigCountByName ¶
get sso_config coutn by name
func TargetCountByFilter ¶
func TargetFilterQueryBuild ¶
func TargetTotal ¶
func TargetUpdateBgid ¶
func TaskRecordTotal ¶
func TaskRecordTotal(ctx *ctx.Context, bgids []int64, beginTime int64, createBy, query string) (int64, error)
list task, filter by group_id, create_by
func TaskTplTotal ¶
func UserGroupCount ¶
func UserGroupIdsOfBusiGroup ¶
func UserGroupMemberCount ¶
func UserGroupMemberDel ¶
func WrapExtendIdent ¶ added in v6.7.0
Types ¶
type AlertAggrView ¶
type AlertAggrView struct { Id int64 `json:"id" gorm:"primaryKey"` Name string `json:"name"` Rule string `json:"rule"` Cate int `json:"cate"` CreateAt int64 `json:"create_at"` CreateBy int64 `json:"create_by"` UpdateAt int64 `json:"update_at"` }
AlertAggrView 在告警聚合视图查看的时候,要存储一些聚合规则
func AlertAggrViewGet ¶
func AlertAggrViewGet(ctx *ctx.Context, where string, args ...interface{}) (*AlertAggrView, error)
func AlertAggrViewGets ¶
func AlertAggrViewGets(ctx *ctx.Context, createBy interface{}) ([]AlertAggrView, error)
func (*AlertAggrView) DB2FE ¶
func (v *AlertAggrView) DB2FE() error
func (*AlertAggrView) TableName ¶
func (v *AlertAggrView) TableName() string
func (*AlertAggrView) Verify ¶
func (v *AlertAggrView) Verify() error
type AlertCurEvent ¶
type AlertCurEvent struct { Id int64 `json:"id" gorm:"primaryKey"` Cate string `json:"cate"` Cluster string `json:"cluster"` DatasourceId int64 `json:"datasource_id"` GroupId int64 `json:"group_id"` // busi group id GroupName string `json:"group_name"` // busi group name Hash string `json:"hash"` // rule_id + vector_key RuleId int64 `json:"rule_id"` RuleName string `json:"rule_name"` RuleNote string `json:"rule_note"` RuleProd string `json:"rule_prod"` RuleAlgo string `json:"rule_algo"` Severity int `json:"severity"` PromForDuration int `json:"prom_for_duration"` PromQl string `json:"prom_ql"` RuleConfig string `json:"-" gorm:"rule_config"` // rule config RuleConfigJson interface{} `json:"rule_config" gorm:"-"` // rule config for fe PromEvalInterval int `json:"prom_eval_interval"` Callbacks string `json:"-"` // for db CallbacksJSON []string `json:"callbacks" gorm:"-"` // for fe RunbookUrl string `json:"runbook_url"` NotifyRecovered int `json:"notify_recovered"` NotifyChannels string `json:"-"` // for db NotifyChannelsJSON []string `json:"notify_channels" gorm:"-"` // for fe NotifyGroups string `json:"-"` // for db NotifyGroupsJSON []string `json:"notify_groups" gorm:"-"` // for fe NotifyGroupsObj []*UserGroup `json:"notify_groups_obj" gorm:"-"` // for fe TargetIdent string `json:"target_ident"` TargetNote string `json:"target_note"` TriggerTime int64 `json:"trigger_time"` TriggerValue string `json:"trigger_value"` Tags string `json:"-"` // for db TagsJSON []string `json:"tags" gorm:"-"` // for fe TagsMap map[string]string `json:"tags_map" gorm:"-"` // for internal usage Annotations string `json:"-"` // AnnotationsJSON map[string]string `json:"annotations" gorm:"-"` // for fe IsRecovered bool `json:"is_recovered" gorm:"-"` // for notify.py NotifyUsersObj []*User `json:"notify_users_obj" gorm:"-"` // for notify.py LastEvalTime int64 `json:"last_eval_time" gorm:"-"` // for notify.py 上次计算的时间 LastSentTime int64 `json:"last_sent_time" gorm:"-"` // 上次发送时间 NotifyCurNumber int `json:"notify_cur_number"` // notify: current number FirstTriggerTime int64 `json:"first_trigger_time"` // 连续告警的首次告警时间 ExtraConfig interface{} `json:"extra_config" gorm:"-"` Status int `json:"status" gorm:"-"` Claimant string `json:"claimant" gorm:"-"` SubRuleId int64 `json:"sub_rule_id" gorm:"-"` ExtraInfo []string `json:"extra_info" gorm:"-"` }
func AlertCurEventGet ¶
func AlertCurEventGet(ctx *ctx.Context, where string, args ...interface{}) (*AlertCurEvent, error)
func AlertCurEventGetById ¶
func AlertCurEventGetById(ctx *ctx.Context, id int64) (*AlertCurEvent, error)
func AlertCurEventGetByIds ¶
func AlertCurEventGetByIds(ctx *ctx.Context, ids []int64) ([]*AlertCurEvent, error)
func AlertCurEventGets ¶
func AlertCurEventGetsFromAlertMute ¶ added in v6.1.0
func AlertCurEventGetsFromAlertMute(ctx *ctx.Context, alertMute *AlertMute) ([]*AlertCurEvent, error)
AlertCurEventGetsFromAlertMute find current events from db.
func (*AlertCurEvent) DB2FE ¶
func (e *AlertCurEvent) DB2FE() error
func (*AlertCurEvent) DB2Mem ¶
func (e *AlertCurEvent) DB2Mem()
func (*AlertCurEvent) FE2DB ¶
func (e *AlertCurEvent) FE2DB()
func (*AlertCurEvent) FillNotifyGroups ¶
for webui
func (*AlertCurEvent) GenCardTitle ¶
func (e *AlertCurEvent) GenCardTitle(rules []*AggrRule) string
func (*AlertCurEvent) GetField ¶
func (e *AlertCurEvent) GetField(field string) string
func (*AlertCurEvent) GetTagValue ¶
func (e *AlertCurEvent) GetTagValue(tagkey string) string
func (*AlertCurEvent) ParseRule ¶
func (e *AlertCurEvent) ParseRule(field string) error
func (*AlertCurEvent) TableName ¶
func (e *AlertCurEvent) TableName() string
func (*AlertCurEvent) ToHis ¶
func (e *AlertCurEvent) ToHis(ctx *ctx.Context) *AlertHisEvent
func (*AlertCurEvent) UpdateFieldsMap ¶
func (m *AlertCurEvent) UpdateFieldsMap(ctx *ctx.Context, fields map[string]interface{}) error
type AlertHisEvent ¶
type AlertHisEvent struct { Id int64 `json:"id" gorm:"primaryKey"` Cate string `json:"cate"` IsRecovered int `json:"is_recovered"` DatasourceId int64 `json:"datasource_id"` Cluster string `json:"cluster"` GroupId int64 `json:"group_id"` GroupName string `json:"group_name"` // busi group name Hash string `json:"hash"` RuleId int64 `json:"rule_id"` RuleName string `json:"rule_name"` RuleNote string `json:"rule_note"` RuleProd string `json:"rule_prod"` RuleAlgo string `json:"rule_algo"` Severity int `json:"severity"` PromForDuration int `json:"prom_for_duration"` PromQl string `json:"prom_ql"` RuleConfig string `json:"-" gorm:"rule_config"` // rule config RuleConfigJson interface{} `json:"rule_config" gorm:"-"` // rule config for fe PromEvalInterval int `json:"prom_eval_interval"` Callbacks string `json:"-"` CallbacksJSON []string `json:"callbacks" gorm:"-"` RunbookUrl string `json:"runbook_url"` NotifyRecovered int `json:"notify_recovered"` NotifyChannels string `json:"-"` NotifyChannelsJSON []string `json:"notify_channels" gorm:"-"` NotifyGroups string `json:"-"` NotifyGroupsJSON []string `json:"notify_groups" gorm:"-"` NotifyGroupsObj []UserGroup `json:"notify_groups_obj" gorm:"-"` TargetIdent string `json:"target_ident"` TargetNote string `json:"target_note"` TriggerTime int64 `json:"trigger_time"` TriggerValue string `json:"trigger_value"` RecoverTime int64 `json:"recover_time"` LastEvalTime int64 `json:"last_eval_time"` Tags string `json:"-"` TagsJSON []string `json:"tags" gorm:"-"` Annotations string `json:"-"` AnnotationsJSON map[string]string `json:"annotations" gorm:"-"` // for fe NotifyCurNumber int `json:"notify_cur_number"` // notify: current number FirstTriggerTime int64 `json:"first_trigger_time"` // 连续告警的首次告警时间 ExtraConfig interface{} `json:"extra_config" gorm:"-"` }
func AlertHisEventGet ¶
func AlertHisEventGet(ctx *ctx.Context, where string, args ...interface{}) (*AlertHisEvent, error)
func AlertHisEventGetById ¶
func AlertHisEventGetById(ctx *ctx.Context, id int64) (*AlertHisEvent, error)
func AlertHisEventGets ¶
func (*AlertHisEvent) DB2FE ¶
func (e *AlertHisEvent) DB2FE()
func (*AlertHisEvent) FillNotifyGroups ¶
func (*AlertHisEvent) TableName ¶
func (e *AlertHisEvent) TableName() string
func (*AlertHisEvent) UpdateFieldsMap ¶
func (m *AlertHisEvent) UpdateFieldsMap(ctx *ctx.Context, fields map[string]interface{}) error
type AlertMute ¶
type AlertMute struct { Id int64 `json:"id" gorm:"primaryKey"` GroupId int64 `json:"group_id"` Note string `json:"note"` Cate string `json:"cate"` Prod string `json:"prod"` DatasourceIds string `json:"-" gorm:"datasource_ids"` // datasource ids DatasourceIdsJson []int64 `json:"datasource_ids" gorm:"-"` // for fe Cluster string `json:"cluster"` // take effect by clusters, seperated by space Tags ormx.JSONArr `json:"tags"` Cause string `json:"cause"` Btime int64 `json:"btime"` Etime int64 `json:"etime"` Disabled int `json:"disabled"` // 0: enabled, 1: disabled CreateBy string `json:"create_by"` UpdateBy string `json:"update_by"` CreateAt int64 `json:"create_at"` UpdateAt int64 `json:"update_at"` ITags []TagFilter `json:"-" gorm:"-"` // inner tags MuteTimeType int `json:"mute_time_type"` // 0: mute by time range, 1: mute by periodic time PeriodicMutes string `json:"-" gorm:"periodic_mutes"` PeriodicMutesJson []PeriodicMute `json:"periodic_mutes" gorm:"-"` Severities string `json:"-" gorm:"severities"` SeveritiesJson []int `json:"severities" gorm:"-"` }
func AlertMuteGet ¶
func AlertMuteGets ¶
func AlertMuteGetsByBG ¶
func AlertMuteGetsByBGIds ¶ added in v6.6.0
func (*AlertMute) UpdateFieldsMap ¶
type AlertNumber ¶
type AlertRule ¶
type AlertRule struct { Id int64 `json:"id" gorm:"primaryKey"` GroupId int64 `json:"group_id"` // busi group id Cate string `json:"cate"` // alert rule cate (prometheus|elasticsearch) DatasourceIds string `json:"-" gorm:"datasource_ids"` // datasource ids DatasourceIdsJson []int64 `json:"datasource_ids" gorm:"-"` // for fe Cluster string `json:"cluster"` // take effect by clusters, seperated by space Name string `json:"name"` // rule name Note string `json:"note"` // will sent in notify Prod string `json:"prod"` // product empty means n9e Algorithm string `json:"algorithm"` // algorithm (”|holtwinters), empty means threshold AlgoParams string `json:"-" gorm:"algo_params"` // params algorithm need AlgoParamsJson interface{} `json:"algo_params" gorm:"-"` // for fe Delay int `json:"delay"` // Time (in seconds) to delay evaluation Severity int `json:"severity"` // 1: Emergency 2: Warning 3: Notice Severities []int `json:"severities" gorm:"-"` // 1: Emergency 2: Warning 3: Notice Disabled int `json:"disabled"` // 0: enabled, 1: disabled PromForDuration int `json:"prom_for_duration"` // prometheus for, unit:s PromQl string `json:"prom_ql"` // just one ql RuleConfig string `json:"-" gorm:"rule_config"` // rule config RuleConfigJson interface{} `json:"rule_config" gorm:"-"` // rule config for fe PromEvalInterval int `json:"prom_eval_interval"` // unit:s EnableStime string `json:"-"` // split by space: "00:00 10:00 12:00" EnableStimeJSON string `json:"enable_stime" gorm:"-"` // for fe EnableStimesJSON []string `json:"enable_stimes" gorm:"-"` // for fe EnableEtime string `json:"-"` // split by space: "00:00 10:00 12:00" EnableEtimeJSON string `json:"enable_etime" gorm:"-"` // for fe EnableEtimesJSON []string `json:"enable_etimes" gorm:"-"` // for fe EnableDaysOfWeek string `json:"-"` // eg: "0 1 2 3 4 5 6 ; 0 1 2" EnableDaysOfWeekJSON []string `json:"enable_days_of_week" gorm:"-"` // for fe EnableDaysOfWeeksJSON [][]string `json:"enable_days_of_weeks" gorm:"-"` // for fe EnableInBG int `json:"enable_in_bg"` // 0: global 1: enable one busi-group NotifyRecovered int `json:"notify_recovered"` // whether notify when recovery NotifyChannels string `json:"-"` // split by space: sms voice email dingtalk wecom NotifyChannelsJSON []string `json:"notify_channels" gorm:"-"` // for fe NotifyGroups string `json:"-"` // split by space: 233 43 NotifyGroupsObj []UserGroup `json:"notify_groups_obj" gorm:"-"` // for fe NotifyGroupsJSON []string `json:"notify_groups" gorm:"-"` // for fe NotifyRepeatStep int `json:"notify_repeat_step"` // notify repeat interval, unit: min NotifyMaxNumber int `json:"notify_max_number"` // notify: max number RecoverDuration int64 `json:"recover_duration"` // unit: s Callbacks string `json:"-"` // split by space: http://a.com/api/x http://a.com/api/y' CallbacksJSON []string `json:"callbacks" gorm:"-"` // for fe RunbookUrl string `json:"runbook_url"` // sop url AppendTags string `json:"-"` // split by space: service=n9e mod=api AppendTagsJSON []string `json:"append_tags" gorm:"-"` // for fe Annotations string `json:"-"` // AnnotationsJSON map[string]string `json:"annotations" gorm:"-"` // for fe ExtraConfig string `json:"-" gorm:"extra_config"` // extra config ExtraConfigJSON interface{} `json:"extra_config" gorm:"-"` // for fe CreateAt int64 `json:"create_at"` CreateBy string `json:"create_by"` UpdateAt int64 `json:"update_at"` UpdateBy string `json:"update_by"` }
func AlertRuleGet ¶
func AlertRuleGetsByBGIds ¶ added in v6.6.0
func AlertRulesGetsBy ¶
func (*AlertRule) FillNotifyGroups ¶
func (*AlertRule) FillSeverities ¶
func (*AlertRule) GenerateNewEvent ¶
func (ar *AlertRule) GenerateNewEvent(ctx *ctx.Context) *AlertCurEvent
func (*AlertRule) GetRuleType ¶
func (*AlertRule) IsHostRule ¶
func (*AlertRule) IsLokiRule ¶ added in v6.2.0
func (*AlertRule) IsPrometheusRule ¶
func (*AlertRule) IsTdengineRule ¶ added in v6.2.0
func (*AlertRule) UpdateColumn ¶
func (*AlertRule) UpdateEvent ¶
func (ar *AlertRule) UpdateEvent(event *AlertCurEvent)
func (*AlertRule) UpdateFieldsMap ¶
type AlertSubscribe ¶
type AlertSubscribe struct { Id int64 `json:"id" gorm:"primaryKey"` Name string `json:"name"` // AlertSubscribe name Disabled int `json:"disabled"` // 0: enabled, 1: disabled GroupId int64 `json:"group_id"` Prod string `json:"prod"` Cate string `json:"cate"` DatasourceIds string `json:"-" gorm:"datasource_ids"` // datasource ids DatasourceIdsJson []int64 `json:"datasource_ids" gorm:"-"` // for fe Cluster string `json:"cluster"` // take effect by clusters, seperated by space RuleId int64 `json:"rule_id"` Severities string `json:"-" gorm:"severities"` // sub severity SeveritiesJson []int `json:"severities" gorm:"-"` // for fe ForDuration int64 `json:"for_duration"` // for duration, unit: second RuleName string `json:"rule_name" gorm:"-"` // for fe Tags ormx.JSONArr `json:"tags"` RedefineSeverity int `json:"redefine_severity"` NewSeverity int `json:"new_severity"` RedefineChannels int `json:"redefine_channels"` NewChannels string `json:"new_channels"` UserGroupIds string `json:"user_group_ids"` UserGroups []UserGroup `json:"user_groups" gorm:"-"` // for fe RedefineWebhooks int `json:"redefine_webhooks"` Webhooks string `json:"-" gorm:"webhooks"` WebhooksJson []string `json:"webhooks" gorm:"-"` ExtraConfig string `json:"-" grom:"extra_config"` ExtraConfigJson interface{} `json:"extra_config" gorm:"-"` // for fe Note string `json:"note"` CreateBy string `json:"create_by"` CreateAt int64 `json:"create_at"` UpdateBy string `json:"update_by"` UpdateAt int64 `json:"update_at"` ITags []TagFilter `json:"-" gorm:"-"` // inner tags BusiGroups ormx.JSONArr `json:"busi_groups"` IBusiGroups []TagFilter `json:"-" gorm:"-"` // inner busiGroups }
func AlertSubscribeGet ¶
func AlertSubscribeGet(ctx *ctx.Context, where string, args ...interface{}) (*AlertSubscribe, error)
func AlertSubscribeGets ¶
func AlertSubscribeGets(ctx *ctx.Context, groupId int64) (lst []AlertSubscribe, err error)
func AlertSubscribeGetsAll ¶
func AlertSubscribeGetsAll(ctx *ctx.Context) ([]*AlertSubscribe, error)
func AlertSubscribeGetsByBGIds ¶ added in v6.6.0
func AlertSubscribeGetsByBGIds(ctx *ctx.Context, bgIds []int64) (lst []AlertSubscribe, err error)
func AlertSubscribeGetsByService ¶
func AlertSubscribeGetsByService(ctx *ctx.Context) (lst []AlertSubscribe, err error)
func (*AlertSubscribe) DB2FE ¶
func (s *AlertSubscribe) DB2FE() error
func (*AlertSubscribe) FE2DB ¶
func (s *AlertSubscribe) FE2DB() error
func (*AlertSubscribe) FillDatasourceIds ¶
func (s *AlertSubscribe) FillDatasourceIds(ctx *ctx.Context) error
for v5 rule
func (*AlertSubscribe) FillRuleName ¶
func (*AlertSubscribe) FillUserGroups ¶
func (*AlertSubscribe) IsDisabled ¶
func (s *AlertSubscribe) IsDisabled() bool
func (*AlertSubscribe) MatchCluster ¶
func (s *AlertSubscribe) MatchCluster(dsId int64) bool
func (*AlertSubscribe) MatchProd ¶
func (s *AlertSubscribe) MatchProd(prod string) bool
func (*AlertSubscribe) ModifyEvent ¶
func (s *AlertSubscribe) ModifyEvent(event *AlertCurEvent)
func (*AlertSubscribe) Parse ¶
func (s *AlertSubscribe) Parse() error
func (*AlertSubscribe) TableName ¶
func (s *AlertSubscribe) TableName() string
func (*AlertSubscribe) Update ¶
func (s *AlertSubscribe) Update(ctx *ctx.Context, selectField interface{}, selectFields ...interface{}) error
func (*AlertSubscribe) UpdateFieldsMap ¶
func (s *AlertSubscribe) UpdateFieldsMap(ctx *ctx.Context, fields map[string]interface{}) error
func (*AlertSubscribe) Verify ¶
func (s *AlertSubscribe) Verify() error
type AlertingEngines ¶
type AlertingEngines struct { Id int64 `json:"id" gorm:"primaryKey"` Instance string `json:"instance"` EngineCluster string `json:"cluster" gorm:"engine_cluster"` DatasourceId int64 `json:"datasource_id"` Clock int64 `json:"clock"` }
func AlertingEngineGet ¶
func AlertingEngineGet(ctx *ctx.Context, where string, args ...interface{}) (*AlertingEngines, error)
func AlertingEngineGets ¶
func AlertingEngineGets(ctx *ctx.Context, where string, args ...interface{}) ([]*AlertingEngines, error)
AlertingEngineGets 拉取列表数据,用户要在页面上看到所有 n9e-server 实例列表,然后为其分配 cluster
func (*AlertingEngines) TableName ¶
func (e *AlertingEngines) TableName() string
func (*AlertingEngines) UpdateDatasourceId ¶
func (e *AlertingEngines) UpdateDatasourceId(ctx *ctx.Context, id int64) error
UpdateCluster 页面上用户会给各个n9e-server分配要关联的目标集群是什么
type Board ¶
type Board struct { Id int64 `json:"id" gorm:"primaryKey"` GroupId int64 `json:"group_id"` Name string `json:"name"` Ident string `json:"ident"` Tags string `json:"tags"` CreateAt int64 `json:"create_at"` CreateBy string `json:"create_by"` UpdateAt int64 `json:"update_at"` UpdateBy string `json:"update_by"` Configs string `json:"configs" gorm:"-"` Public int `json:"public"` // 0: false, 1: true BuiltIn int `json:"built_in"` // 0: false, 1: true Hide int `json:"hide"` // 0: false, 1: true }
func BoardGetsByBGIds ¶ added in v6.6.0
func BoardGetsByGroupId ¶
BoardGets for list page
func (*Board) CanRenameIdent ¶
type BoardPayload ¶
func BoardPayloadGets ¶
func BoardPayloadGets(ctx *ctx.Context, ids []int64) ([]*BoardPayload, error)
func (*BoardPayload) TableName ¶
func (p *BoardPayload) TableName() string
type BuiltinCate ¶
type BuiltinCate struct { Id int64 `json:"id" gorm:"primaryKey"` Name string `json:"name"` UserId int64 `json:"user_id"` }
func (*BuiltinCate) TableName ¶
func (b *BuiltinCate) TableName() string
type BusiGroup ¶
type BusiGroup struct { Id int64 `json:"id" gorm:"primaryKey"` Name string `json:"name"` LabelEnable int `json:"label_enable"` LabelValue string `json:"label_value"` CreateAt int64 `json:"create_at"` CreateBy string `json:"create_by"` UpdateAt int64 `json:"update_at"` UpdateBy string `json:"update_by"` UserGroups []UserGroupWithPermFlag `json:"user_groups" gorm:"-"` DB *gorm.DB `json:"-" gorm:"-"` }
func BusiGroupGet ¶
func (*BusiGroup) AddMembers ¶
func (*BusiGroup) DelMembers ¶
type BusiGroupMember ¶
type BusiGroupMember struct { BusiGroupId int64 `json:"busi_group_id"` UserGroupId int64 `json:"user_group_id"` PermFlag string `json:"perm_flag"` }
func BusiGroupMemberGet ¶
func BusiGroupMemberGet(ctx *ctx.Context, where string, args ...interface{}) (*BusiGroupMember, error)
func BusiGroupMemberGets ¶
func BusiGroupMemberGets(ctx *ctx.Context, where string, args ...interface{}) ([]BusiGroupMember, error)
func BusiGroupMemberGetsByBusiGroupId ¶
func BusiGroupMemberGetsByBusiGroupId(ctx *ctx.Context, busiGroupId int64) ([]BusiGroupMember, error)
func (*BusiGroupMember) DB2FE ¶
func (bgm *BusiGroupMember) DB2FE() error
func (BusiGroupMember) TableName ¶
func (BusiGroupMember) TableName() string
type Chart ¶
type ChartGroup ¶
type ChartGroup struct { Id int64 `json:"id" gorm:"primaryKey"` DashboardId int64 `json:"dashboard_id"` Name string `json:"name"` Weight int `json:"weight"` }
func ChartGroupsOf ¶
func ChartGroupsOf(ctx *ctx.Context, dashId int64) ([]ChartGroup, error)
func (*ChartGroup) TableName ¶
func (cg *ChartGroup) TableName() string
func (*ChartGroup) Update ¶
func (cg *ChartGroup) Update(ctx *ctx.Context, selectField interface{}, selectFields ...interface{}) error
func (*ChartGroup) Verify ¶
func (cg *ChartGroup) Verify() error
type ChartShare ¶
type ChartShare struct {}
func ChartShareGetsByIds ¶
func ChartShareGetsByIds(ctx *ctx.Context, ids []int64) ([]ChartShare, error)
func (*ChartShare) TableName ¶
func (cs *ChartShare) TableName() string
type Configs ¶
type Configs struct { Id int64 `json:"id" gorm:"primaryKey"` Ckey string `json:"ckey"` // Before inserting external configs, check if they are already defined as built-in configs. Cval string `json:"cval"` Note string `json:"note"` External int `json:"external"` //Controls frontend list display: 0 hides built-in (default), 1 shows external Encrypted int `json:"encrypted"` //Indicates whether the value(cval) is encrypted (1 for ciphertext, 0 for plaintext(default)) CreateAt int64 `json:"create_at"` CreateBy string `json:"create_by"` UpdateAt int64 `json:"update_at"` UpdateBy string `json:"update_by"` }
func ConfigsGetUserVariable ¶ added in v6.3.0
func ConfigsGets ¶
func ConfigsSelectByCkey ¶ added in v6.3.0
type Dashboard ¶
type Dashboard struct { Id int64 `json:"id" gorm:"primaryKey"` GroupId int64 `json:"group_id"` Name string `json:"name"` Tags string `json:"-"` TagsLst []string `json:"tags" gorm:"-"` Configs string `json:"configs"` 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 ¶
type DataResp ¶ added in v6.2.0
type DataResp struct { Ref string `json:"ref"` Metric model.Metric `json:"metric"` Labels string `json:"-"` Values [][]float64 `json:"values"` }
func (*DataResp) MetricName ¶ added in v6.2.0
type Datasource ¶
type Datasource struct { Id int64 `json:"id"` Name string `json:"name"` Description string `json:"description"` PluginId int64 `json:"plugin_id"` PluginType string `json:"plugin_type"` // prometheus PluginTypeName string `json:"plugin_type_name"` // Prometheus Like Category string `json:"category"` // timeseries ClusterName string `json:"cluster_name"` Settings string `json:"-" gorm:"settings"` SettingsJson map[string]interface{} `json:"settings" gorm:"-"` Status string `json:"status"` HTTP string `json:"-" gorm:"http"` HTTPJson HTTP `json:"http" gorm:"-"` Auth string `json:"-" gorm:"auth"` AuthJson Auth `json:"auth" gorm:"-"` CreatedAt int64 `json:"created_at"` UpdatedAt int64 `json:"updated_at"` CreatedBy string `json:"created_by"` UpdatedBy string `json:"updated_by"` IsDefault bool `json:"is_default"` Transport *http.Transport `json:"-" gorm:"-"` }
func DatasourceGet ¶
func DatasourceGet(ctx *ctx.Context, id int64) (*Datasource, error)
func GetDatasources ¶
func GetDatasources(ctx *ctx.Context) ([]Datasource, error)
func GetDatasourcesGetsBy ¶
func GetDatasourcesGetsBy(ctx *ctx.Context, typ, cate, name, status string) ([]*Datasource, error)
func (*Datasource) DB2FE ¶
func (ds *Datasource) DB2FE() error
func (*Datasource) FE2DB ¶
func (ds *Datasource) FE2DB() error
func (*Datasource) TableName ¶
func (ds *Datasource) TableName() string
func (*Datasource) Update ¶
func (ds *Datasource) Update(ctx *ctx.Context, selectField interface{}, selectFields ...interface{}) error
func (*Datasource) Verify ¶
func (ds *Datasource) Verify() error
type EsIndexPattern ¶
type EsIndexPattern struct { Id int64 `json:"id" gorm:"primaryKey"` DatasourceId int64 `json:"datasource_id"` Name string `json:"name"` TimeField string `json:"time_field"` AllowHideSystemIndices int `json:"-" gorm:"allow_hide_system_indices"` AllowHideSystemIndicesBool bool `json:"allow_hide_system_indices" gorm:"-"` FieldsFormat string `json:"fields_format"` CreateAt int64 `json:"create_at"` CreateBy string `json:"create_by"` UpdateAt int64 `json:"update_at"` UpdateBy string `json:"update_by"` }
func EsIndexPatternGet ¶
func EsIndexPatternGet(ctx *ctx.Context, where string, args ...interface{}) (*EsIndexPattern, error)
func EsIndexPatternGetById ¶
func EsIndexPatternGetById(ctx *ctx.Context, id int64) (*EsIndexPattern, error)
func EsIndexPatternGets ¶
func EsIndexPatternGets(ctx *ctx.Context, where string, args ...interface{}) ([]*EsIndexPattern, error)
func (*EsIndexPattern) DB2FE ¶ added in v6.1.0
func (dbIndexPatten *EsIndexPattern) DB2FE()
func (*EsIndexPattern) FE2DB ¶ added in v6.1.0
func (feIndexPatten *EsIndexPattern) FE2DB()
func (*EsIndexPattern) TableName ¶
func (t *EsIndexPattern) TableName() string
func (*EsIndexPattern) Update ¶
func (ei *EsIndexPattern) Update(ctx *ctx.Context, eip EsIndexPattern) error
type HTTP ¶
type HeartbeatInfo ¶
type HostMeta ¶
type HostMeta struct { AgentVersion string `json:"agent_version"` OS string `json:"os"` Arch string `json:"arch"` Hostname string `json:"hostname"` CpuNum int `json:"cpu_num"` CpuUtil float64 `json:"cpu_util"` MemUtil float64 `json:"mem_util"` Offset int64 `json:"offset"` UnixTime int64 `json:"unixtime"` RemoteAddr string `json:"remote_addr"` HostIp string `json:"host_ip"` GlobalLabels map[string]string `json:"global_labels"` ExtendInfo map[string]interface{} `json:"extend_info"` }
func (HostMeta) MarshalBinary ¶
func (*HostMeta) UnmarshalBinary ¶
type HostRuleConfig ¶
type HostRuleConfig struct { Queries []HostQuery `json:"queries"` Triggers []HostTrigger `json:"triggers"` Inhibit bool `json:"inhibit"` }
type HostTrigger ¶
type LabelAndKey ¶
type MetricView ¶
type MetricView struct { Id int64 `json:"id" gorm:"primaryKey"` Name string `json:"name"` Cate int `json:"cate"` Configs string `json:"configs"` CreateAt int64 `json:"create_at"` CreateBy int64 `json:"create_by"` UpdateAt int64 `json:"update_at"` }
MetricView 在告警聚合视图查看的时候,要存储一些聚合规则
func MetricViewGet ¶
func MetricViewGet(ctx *ctx.Context, where string, args ...interface{}) (*MetricView, error)
func MetricViewGets ¶
func MetricViewGets(ctx *ctx.Context, createBy interface{}) ([]MetricView, error)
func (*MetricView) DB2FE ¶
func (v *MetricView) DB2FE() error
func (*MetricView) TableName ¶
func (v *MetricView) TableName() string
func (*MetricView) Verify ¶
func (v *MetricView) Verify() error
type NotifyChannel ¶
type NotifyContact ¶
type NotifyScript ¶
type NotifyTpl ¶
type NotifyTpl struct { Id int64 `json:"id"` Name string `json:"name"` Channel string `json:"channel"` Content string `json:"content"` BuiltIn bool `json:"built_in" gorm:"-"` CreateAt int64 `json:"create_at"` CreateBy string `json:"create_by"` UpdateAt int64 `json:"update_at"` UpdateBy string `json:"update_by"` }
func NotifyTplGet ¶ added in v6.7.0
get notify by id
func (*NotifyTpl) CreateIfNotExists ¶
func (*NotifyTpl) NotifyTplDelete ¶
type PeriodicMute ¶
type PromRuleConfig ¶
type QueryConfig ¶
type QueryParam ¶ added in v6.2.0
type RecordingRule ¶
type RecordingRule struct { Id int64 `json:"id" gorm:"primaryKey"` GroupId int64 `json:"group_id"` // busi group id DatasourceIds string `json:"-" gorm:"datasource_ids"` // datasource ids DatasourceIdsJson []int64 `json:"datasource_ids" gorm:"-"` // for fe Cluster string `json:"cluster"` // take effect by cluster, seperated by space Name string `json:"name"` // new metric name Disabled int `json:"disabled"` // 0: enabled, 1: disabled PromQl string `json:"prom_ql"` // just one ql for promql QueryConfigs string `json:"-" gorm:"query_configs"` // query_configs QueryConfigsJson []QueryConfig `json:"query_configs" gorm:"-"` // query_configs for fe PromEvalInterval int `json:"prom_eval_interval"` // unit:s AppendTags string `json:"-"` // split by space: service=n9e mod=api AppendTagsJSON []string `json:"append_tags" gorm:"-"` // for fe Note string `json:"note"` // note CreateAt int64 `json:"create_at"` CreateBy string `json:"create_by"` UpdateAt int64 `json:"update_at"` UpdateBy string `json:"update_by"` }
A RecordingRule records its vector expression into new timeseries.
func RecordingRuleEnabledGets ¶
func RecordingRuleEnabledGets(ctx *ctx.Context) ([]*RecordingRule, error)
func RecordingRuleGet ¶
func RecordingRuleGet(ctx *ctx.Context, where string, regs ...interface{}) (*RecordingRule, error)
func RecordingRuleGetById ¶
func RecordingRuleGetById(ctx *ctx.Context, id int64) (*RecordingRule, error)
func RecordingRuleGets ¶
func RecordingRuleGets(ctx *ctx.Context, groupId int64) ([]RecordingRule, error)
func RecordingRuleGetsByBGIds ¶ added in v6.6.0
func RecordingRuleGetsByBGIds(ctx *ctx.Context, bgIds []int64) ([]RecordingRule, error)
func RecordingRuleGetsByCluster ¶
func RecordingRuleGetsByCluster(ctx *ctx.Context) ([]*RecordingRule, error)
func (*RecordingRule) DB2FE ¶
func (re *RecordingRule) DB2FE() error
func (*RecordingRule) FE2DB ¶
func (re *RecordingRule) FE2DB()
func (*RecordingRule) TableName ¶
func (re *RecordingRule) TableName() string
func (*RecordingRule) Update ¶
func (re *RecordingRule) Update(ctx *ctx.Context, ref RecordingRule) error
func (*RecordingRule) UpdateFieldsMap ¶
func (re *RecordingRule) UpdateFieldsMap(ctx *ctx.Context, fields map[string]interface{}) error
func (*RecordingRule) Verify ¶
func (re *RecordingRule) Verify() error
type RelationKey ¶ added in v6.2.0
type Role ¶
type RoleOperation ¶
func (*RoleOperation) DB2FE ¶ added in v6.6.0
func (r *RoleOperation) DB2FE() error
func (RoleOperation) TableName ¶
func (RoleOperation) TableName() string
type SsoConfig ¶
type Statistics ¶
func AlertMuteStatistics ¶
func AlertMuteStatistics(ctx *ctx.Context) (*Statistics, error)
func AlertRuleStatistics ¶
func AlertRuleStatistics(ctx *ctx.Context) (*Statistics, error)
func AlertSubscribeStatistics ¶
func AlertSubscribeStatistics(ctx *ctx.Context) (*Statistics, error)
func BusiGroupStatistics ¶
func BusiGroupStatistics(ctx *ctx.Context) (*Statistics, error)
func ConfigsUserVariableStatistics ¶ added in v6.4.0
func ConfigsUserVariableStatistics(context *ctx.Context) (*Statistics, error)
func DatasourceStatistics ¶
func DatasourceStatistics(ctx *ctx.Context) (*Statistics, error)
func RecordingRuleStatistics ¶
func RecordingRuleStatistics(ctx *ctx.Context) (*Statistics, error)
func StatisticsGet ¶
func StatisticsGet[T any](ctx *ctx.Context, model T) (*Statistics, error)
func TargetStatistics ¶
func TargetStatistics(ctx *ctx.Context) (*Statistics, error)
func UserGroupStatistics ¶
func UserGroupStatistics(ctx *ctx.Context) (*Statistics, error)
func UserStatistics ¶
func UserStatistics(ctx *ctx.Context) (*Statistics, error)
type TagFilter ¶
type TagFilter struct { Key string `json:"key"` // tag key Func string `json:"func"` // `==` | `=~` | `in` | `!=` | `!~` | `not in` Value string `json:"value"` // tag value Regexp *regexp.Regexp // parse value to regexp if func = '=~' or '!~' Vset map[string]struct{} // parse value to regexp if func = 'in' or 'not in' }
type Target ¶
type Target struct { Id int64 `json:"id" gorm:"primaryKey"` GroupId int64 `json:"group_id"` GroupObj *BusiGroup `json:"group_obj" gorm:"-"` Ident string `json:"ident"` Note string `json:"note"` Tags string `json:"-"` TagsJSON []string `json:"tags" gorm:"-"` TagsMap map[string]string `json:"tags_maps" gorm:"-"` // internal use, append tags to series UpdateAt int64 `json:"update_at"` HostIp string `json:"host_ip"` //ipv4,do not needs range select AgentVersion string `json:"agent_version"` UnixTime int64 `json:"unixtime" gorm:"-"` Offset int64 `json:"offset" gorm:"-"` TargetUp float64 `json:"target_up" gorm:"-"` MemUtil float64 `json:"mem_util" gorm:"-"` CpuNum int `json:"cpu_num" gorm:"-"` CpuUtil float64 `json:"cpu_util" gorm:"-"` OS string `json:"os" gorm:"-"` Arch string `json:"arch" gorm:"-"` RemoteAddr string `json:"remote_addr" gorm:"-"` }
func MissTargetGetsByFilter ¶
func TargetGets ¶
func TargetGetsByFilter ¶
func TargetGetsByFilter(ctx *ctx.Context, query []map[string]interface{}, limit, offset int) ([]*Target, error)
根据 groupids, tags, hosts 查询 targets
func (*Target) FillTagsMap ¶
func (t *Target) FillTagsMap()
func (*Target) GetTagsMap ¶ added in v6.7.1
type TaskRecord ¶
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"` IbexAuthPass string `json:"ibex_auth_pass"` Title string `json:"title"` Account string `json:"account"` Batch int `json:"batch"` Tolerance int `json:"tolerance"` Timeout int `json:"timeout"` Pause string `json:"pause"` Script string `json:"script"` Args string `json:"args"` CreateAt int64 `json:"create_at"` CreateBy string `json:"create_by"` }
func TaskRecordGets ¶
func (*TaskRecord) TableName ¶
func (r *TaskRecord) TableName() string
func (*TaskRecord) UpdateIsDone ¶
func (r *TaskRecord) UpdateIsDone(ctx *ctx.Context, isDone int) error
update is_done field
type TaskTpl ¶
type TaskTpl struct { Id int64 `json:"id" gorm:"primaryKey"` GroupId int64 `json:"group_id"` Title string `json:"title"` Batch int `json:"batch"` Tolerance int `json:"tolerance"` Timeout int `json:"timeout"` Pause string `json:"pause"` Script string `json:"script"` Args string `json:"args"` Tags string `json:"-"` TagsJSON []string `json:"tags" gorm:"-"` Account string `json:"account"` CreateAt int64 `json:"create_at"` CreateBy string `json:"create_by"` UpdateAt int64 `json:"update_at"` UpdateBy string `json:"update_by"` }
func TaskTplGet ¶
func TaskTplGetById ¶ added in v6.0.1
func TaskTplGets ¶
func (*TaskTpl) CleanFields ¶
type User ¶
type User struct { Id int64 `json:"id" gorm:"primaryKey"` Username string `json:"username"` Nickname string `json:"nickname"` Password string `json:"-"` Phone string `json:"phone"` Email string `json:"email"` Portrait string `json:"portrait"` Roles string `json:"-"` // 这个字段写入数据库 RolesLst []string `json:"roles" gorm:"-"` // 这个字段和前端交互 Contacts ormx.JSONObj `json:"contacts"` // 内容为 map[string]string 结构 Maintainer int `json:"maintainer"` // 是否给管理员发消息 0:not send 1:send CreateAt int64 `json:"create_at"` CreateBy string `json:"create_by"` UpdateAt int64 `json:"update_at"` UpdateBy string `json:"update_by"` Admin bool `json:"admin" gorm:"-"` // 方便前端使用 }
func (*User) BusiGroups ¶
func (u *User) BusiGroups(ctx *ctx.Context, limit int, query string, all ...bool) ([]BusiGroup, error)
我是管理员,返回所有 或者我是成员
func (*User) CanDoBusiGroup ¶
func (*User) CanModifyUserGroup ¶
func (*User) ChangePassword ¶
func (*User) NopriIdents ¶
func (*User) UpdatePassword ¶
func (*User) UserGroups ¶
type UserGroup ¶
type UserGroup struct { Id int64 `json:"id" gorm:"primaryKey"` 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"` UserIds []int64 `json:"-" gorm:"-"` }
func UserGroupGet ¶
func (*UserGroup) AddMembers ¶
func (*UserGroup) DelMembers ¶
type UserGroupMember ¶
func UserGroupMemberGetAll ¶
func UserGroupMemberGetAll(ctx *ctx.Context) ([]*UserGroupMember, error)
func (UserGroupMember) DB2FE ¶
func (UserGroupMember) DB2FE() error
func (UserGroupMember) TableName ¶
func (UserGroupMember) TableName() string
type UserGroupWithPermFlag ¶
type Webhook ¶
type Webhook struct { Enable bool `json:"enable"` Url string `json:"url"` BasicAuthUser string `json:"basic_auth_user"` BasicAuthPass string `json:"basic_auth_pass"` Timeout int `json:"timeout"` HeaderMap map[string]string `json:"headers"` Headers []string `json:"headers_str"` SkipVerify bool `json:"skip_verify"` Note string `json:"note"` }
Source Files ¶
- alert_aggr_view.go
- alert_cur_event.go
- alert_his_event.go
- alert_mute.go
- alert_rule.go
- alert_subscribe.go
- alerting_engine.go
- board.go
- board_payload.go
- builtin_cate.go
- busi_group.go
- busi_group_member.go
- chart.go
- chart_group.go
- chart_share.go
- common.go
- configs.go
- dashboard.go
- datasource.go
- es_index_pattern.go
- host_meta.go
- metric_view.go
- notify_config.go
- notify_tpl.go
- recording_rule.go
- role.go
- role_operation.go
- sso_config.go
- target.go
- task_record.go
- task_tpl.go
- ts.go
- user.go
- user_group.go
- user_group_member.go