Documentation ¶
Index ¶
- Constants
- Variables
- func AuthConfig() *models.AuthConfig
- func Init(regions []string)
- func InitApiDetectorHashRing(regions []string)
- func InitHistoryBigMap()
- func InitJudgeHashRing()
- func InitSnmpDetectorHashRing(regions []string)
- func LoadFile() (map[string][]*dataobj.Metric, error)
- func LoadMetrics()
- func NewCollectRuleCache(regions []string) *collectRuleCache
- func RebuildConsistentHashRing(hashRing *ConsistentHashRing, nodes []string, replicas int)
- func Start()
- func Stop()
- type AggrCalcCacheMap
- type AlarmStraCacheMap
- type ApiCollectCacheMap
- type Cache
- type CollectCacheMap
- type ConsistentHashRing
- type IndexMap
- type JudgeItemMap
- type MaskCacheMap
- type ModuleMetricMap
- type NodeMap
- type SafeAggrCalcMap
- func (s *SafeAggrCalcMap) GetAll() []*dataobj.RawMetricAggrCalc
- func (s *SafeAggrCalcMap) GetByKey(key string) []*dataobj.RawMetricAggrCalc
- func (s *SafeAggrCalcMap) GetMetric(id int64) string
- func (s *SafeAggrCalcMap) ReInit(m map[string]map[string][]*dataobj.RawMetricAggrCalc)
- func (s *SafeAggrCalcMap) ReInitMetric(m map[int64]string)
- type SafeEventMap
- type SafeJudgeQueue
- func (s *SafeJudgeQueue) Clean()
- func (s *SafeJudgeQueue) Del(instance string)
- func (s *SafeJudgeQueue) Exists(instance string) bool
- func (s *SafeJudgeQueue) Get(instance string) (*list.SafeListLimited, bool)
- func (s *SafeJudgeQueue) GetAll() map[string]*list.SafeListLimited
- func (s *SafeJudgeQueue) Set(instance string, q *list.SafeListLimited)
- func (s *SafeJudgeQueue) UpdateTS(instance string)
- type SafeLinkedList
- func (ll *SafeLinkedList) Front() *list.Element
- func (ll *SafeLinkedList) HistoryData() []*dataobj.HistoryData
- func (ll *SafeLinkedList) Len() int
- func (ll *SafeLinkedList) PushFrontAndMaintain(v *dataobj.JudgeItem, alertDur int) bool
- func (ll *SafeLinkedList) QueryDataByTS(start, end int64) []*dataobj.HistoryData
- type SafeStraMap
- type Series
- type SnmpCollectCacheMap
- type SnmpHWCacheMap
- type StraCacheMap
- type StrategyMap
Constants ¶
View Source
const CHECK_INTERVAL = 9
View Source
const DetectorReplicas = 500
View Source
const JudgesReplicas = 500
View Source
const ProbersReplicas = 500
Variables ¶
View Source
var ActiveJudgeNode = NewNodeMap()
View Source
var ( AggrCalcMap = &SafeAggrCalcMap{ M: make(map[string]map[string][]*dataobj.RawMetricAggrCalc), MetricMap: make(map[int64]string), } )
View Source
var ApiDetectorHashRing map[string]*ConsistentHashRing
View Source
var CollectRuleCache *collectRuleCache
View Source
var CommonModule string
View Source
var ( DefaultCache = &Cache{ interval: 10, config: configCache{ authConfig: &models.DefaultAuthConfig, }, } )
View Source
var HistoryBigMap = make(map[string]*JudgeItemMap)
这是个线程不安全的大Map,需要提前初始化好
View Source
var (
LastEvents = &SafeEventMap{M: make(map[string]*dataobj.Event)}
)
View Source
var SnmpDetectorHashRing map[string]*ConsistentHashRing
View Source
var (
StraMap = &SafeStraMap{M: make(map[string]map[string][]*models.Stra)}
)
Functions ¶
func AuthConfig ¶
func AuthConfig() *models.AuthConfig
func InitApiDetectorHashRing ¶
func InitApiDetectorHashRing(regions []string)
func InitHistoryBigMap ¶
func InitHistoryBigMap()
func InitJudgeHashRing ¶
func InitJudgeHashRing()
func InitSnmpDetectorHashRing ¶
func InitSnmpDetectorHashRing(regions []string)
func LoadMetrics ¶
func LoadMetrics()
func NewCollectRuleCache ¶
func NewCollectRuleCache(regions []string) *collectRuleCache
func RebuildConsistentHashRing ¶
func RebuildConsistentHashRing(hashRing *ConsistentHashRing, nodes []string, replicas int)
Types ¶
type AggrCalcCacheMap ¶
var AggrCalcStraCache *AggrCalcCacheMap
func NewAggrCalcStraCache ¶
func NewAggrCalcStraCache() *AggrCalcCacheMap
func (*AggrCalcCacheMap) Get ¶
func (a *AggrCalcCacheMap) Get() []*models.AggrCalc
func (*AggrCalcCacheMap) Set ¶
func (a *AggrCalcCacheMap) Set(stras []*models.AggrCalc)
type AlarmStraCacheMap ¶
var AlarmStraCache *AlarmStraCacheMap
func NewAlarmStraCache ¶
func NewAlarmStraCache() *AlarmStraCacheMap
type ApiCollectCacheMap ¶
type ApiCollectCacheMap struct { sync.RWMutex Data map[string][]*models.ApiCollect }
var ApiCollectCache *ApiCollectCacheMap
func NewApiCollectCache ¶
func NewApiCollectCache() *ApiCollectCacheMap
func (*ApiCollectCacheMap) GetBy ¶
func (c *ApiCollectCacheMap) GetBy(node string) []*models.ApiCollect
func (*ApiCollectCacheMap) Set ¶
func (c *ApiCollectCacheMap) Set(node string, collects []*models.ApiCollect)
func (*ApiCollectCacheMap) SetAll ¶
func (c *ApiCollectCacheMap) SetAll(data map[string][]*models.ApiCollect)
type CollectCacheMap ¶
var CollectCache *CollectCacheMap
func NewCollectCache ¶
func NewCollectCache() *CollectCacheMap
type ConsistentHashRing ¶
var JudgeHashRing *ConsistentHashRing
func NewConsistentHashRing ¶
func NewConsistentHashRing(replicas int32, nodes []string) *ConsistentHashRing
func (*ConsistentHashRing) GetNode ¶
func (this *ConsistentHashRing) GetNode(pk string) (string, error)
func (*ConsistentHashRing) GetRing ¶
func (this *ConsistentHashRing) GetRing() *consistent.Consistent
func (*ConsistentHashRing) Set ¶
func (this *ConsistentHashRing) Set(r *consistent.Consistent)
type JudgeItemMap ¶
type JudgeItemMap struct { sync.RWMutex M map[string]*SafeLinkedList }
func NewJudgeItemMap ¶
func NewJudgeItemMap() *JudgeItemMap
func (*JudgeItemMap) BatchDelete ¶
func (j *JudgeItemMap) BatchDelete(keys []string)
func (*JudgeItemMap) CleanStale ¶
func (j *JudgeItemMap) CleanStale(before int64)
func (*JudgeItemMap) Get ¶
func (j *JudgeItemMap) Get(key string) (*SafeLinkedList, bool)
func (*JudgeItemMap) Len ¶
func (j *JudgeItemMap) Len() int
func (*JudgeItemMap) Set ¶
func (j *JudgeItemMap) Set(key string, val *SafeLinkedList)
type MaskCacheMap ¶
var MaskCache *MaskCacheMap
func NewMaskCache ¶
func NewMaskCache() *MaskCacheMap
func (*MaskCacheMap) SetAll ¶
func (this *MaskCacheMap) SetAll(m map[string][]string)
type ModuleMetricMap ¶
var ModuleMetric ModuleMetricMap
func (*ModuleMetricMap) Get ¶
func (m *ModuleMetricMap) Get(module, metricName string) (*dataobj.Metric, bool)
func (*ModuleMetricMap) GetByModule ¶
func (m *ModuleMetricMap) GetByModule(module string) map[string]*dataobj.Metric
type NodeMap ¶
func NewNodeMap ¶
func NewNodeMap() NodeMap
type SafeAggrCalcMap ¶
type SafeAggrCalcMap struct { sync.RWMutex M map[string]map[string][]*dataobj.RawMetricAggrCalc MetricMap map[int64]string }
func (*SafeAggrCalcMap) GetAll ¶
func (s *SafeAggrCalcMap) GetAll() []*dataobj.RawMetricAggrCalc
func (*SafeAggrCalcMap) GetByKey ¶
func (s *SafeAggrCalcMap) GetByKey(key string) []*dataobj.RawMetricAggrCalc
func (*SafeAggrCalcMap) GetMetric ¶
func (s *SafeAggrCalcMap) GetMetric(id int64) string
func (*SafeAggrCalcMap) ReInit ¶
func (s *SafeAggrCalcMap) ReInit(m map[string]map[string][]*dataobj.RawMetricAggrCalc)
func (*SafeAggrCalcMap) ReInitMetric ¶
func (s *SafeAggrCalcMap) ReInitMetric(m map[int64]string)
type SafeEventMap ¶
type SafeJudgeQueue ¶
type SafeJudgeQueue struct { sync.RWMutex Data map[string]*list.SafeListLimited Ts map[string]int64 }
func NewJudgeQueue ¶
func NewJudgeQueue() SafeJudgeQueue
func (*SafeJudgeQueue) Clean ¶
func (s *SafeJudgeQueue) Clean()
func (*SafeJudgeQueue) Del ¶
func (s *SafeJudgeQueue) Del(instance string)
func (*SafeJudgeQueue) Exists ¶
func (s *SafeJudgeQueue) Exists(instance string) bool
func (*SafeJudgeQueue) Get ¶
func (s *SafeJudgeQueue) Get(instance string) (*list.SafeListLimited, bool)
func (*SafeJudgeQueue) GetAll ¶
func (s *SafeJudgeQueue) GetAll() map[string]*list.SafeListLimited
func (*SafeJudgeQueue) Set ¶
func (s *SafeJudgeQueue) Set(instance string, q *list.SafeListLimited)
func (*SafeJudgeQueue) UpdateTS ¶
func (s *SafeJudgeQueue) UpdateTS(instance string)
type SafeLinkedList ¶
func (*SafeLinkedList) Front ¶
func (ll *SafeLinkedList) Front() *list.Element
func (*SafeLinkedList) HistoryData ¶
func (ll *SafeLinkedList) HistoryData() []*dataobj.HistoryData
@param limit 至多返回这些,如果不够,有多少返回多少
func (*SafeLinkedList) Len ¶
func (ll *SafeLinkedList) Len() int
func (*SafeLinkedList) PushFrontAndMaintain ¶
func (ll *SafeLinkedList) PushFrontAndMaintain(v *dataobj.JudgeItem, alertDur int) bool
@return needJudge 如果是false不需要做judge,因为新上来的数据不合法
func (*SafeLinkedList) QueryDataByTS ¶
func (ll *SafeLinkedList) QueryDataByTS(start, end int64) []*dataobj.HistoryData
type SafeStraMap ¶
func (*SafeStraMap) GetAll ¶
func (s *SafeStraMap) GetAll() []*models.Stra
type SnmpCollectCacheMap ¶
snmp
var SnmpCollectCache *SnmpCollectCacheMap
func NewSnmpCollectCache ¶
func NewSnmpCollectCache() *SnmpCollectCacheMap
func (*SnmpCollectCacheMap) GetBy ¶
func (c *SnmpCollectCacheMap) GetBy(node string) []*dataobj.IPAndSnmp
type SnmpHWCacheMap ¶
type SnmpHWCacheMap struct { sync.RWMutex Data map[string][]*models.NetworkHardware }
var SnmpHWCache *SnmpHWCacheMap
func NewSnmpHWCache ¶
func NewSnmpHWCache() *SnmpHWCacheMap
func (*SnmpHWCacheMap) GetBy ¶
func (c *SnmpHWCacheMap) GetBy(node string) []*models.NetworkHardware
func (*SnmpHWCacheMap) Set ¶
func (c *SnmpHWCacheMap) Set(node string, hws []*models.NetworkHardware)
func (*SnmpHWCacheMap) SetAll ¶
func (c *SnmpHWCacheMap) SetAll(data map[string][]*models.NetworkHardware)
type StraCacheMap ¶
var StraCache *StraCacheMap
func NewStraCache ¶
func NewStraCache() *StraCacheMap
func (*StraCacheMap) GetAll ¶
func (s *StraCacheMap) GetAll() []*models.Stra
type StrategyMap ¶
var NodataStra *StrategyMap
var Strategy *StrategyMap
func NewStrategyMap ¶
func NewStrategyMap() *StrategyMap
func (*StrategyMap) Clean ¶
func (s *StrategyMap) Clean()
func (*StrategyMap) GetAll ¶
func (s *StrategyMap) GetAll() []*models.Stra
Source Files ¶
Click to show internal directories.
Click to hide internal directories.