hbscache

package
v3.15.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Agents = NewSafeAgents()
View Source
var ExpressionCache = &SafeExpressionCache{}
View Source
var GitRepo = &SafeGitRepo{gitRepo: ""}
View Source
var GroupPlugins = &SafeGroupPlugins{M: make(map[int][]string)}
View Source
var GroupTemplates = &SafeGroupTemplates{M: make(map[int][]int)}
View Source
var HostGroupsMap = &SafeHostGroupsMap{M: make(map[int][]int)}
View Source
var HostMap = &SafeHostMap{M: make(map[string]int)}
View Source
var HostTemplateIds = &SafeHostTemplateIds{M: make(map[int][]int)}
View Source
var MonitoredHosts = &SafeMonitoredHosts{M: make(map[int]*model.Host)}
View Source
var Strategies = &SafeStrategies{M: make(map[int]*model.NewStrategy)}
View Source
var TemplateCache = &SafeTemplateCache{M: make(map[int]*model.NewTemplate)}

Functions

func DeleteStaleAgents

func DeleteStaleAgents()

func GetBuiltinMetrics

func GetBuiltinMetrics(hostname string) ([]*model.NewBuiltinMetric, error)

func GetPlugins

func GetPlugins(hostname string) []string

根据hostname获取关联的插件

func Init

func Init()

func LoopInit

func LoopInit()

func ParentIds

func ParentIds(allTpls map[int]*model.NewTemplate, tid int) (ret []int)

Types

type SafeAgents

type SafeAgents struct {
	sync.RWMutex
	M map[string]*model.AgentUpdateInfo
}

func NewSafeAgents

func NewSafeAgents() *SafeAgents

func (*SafeAgents) Delete

func (this *SafeAgents) Delete(hostname string)

func (*SafeAgents) Get

func (this *SafeAgents) Get(hostname string) (*model.AgentUpdateInfo, bool)

func (*SafeAgents) Keys

func (this *SafeAgents) Keys() []string

func (*SafeAgents) Put

func (this *SafeAgents) Put(req *model.AgentReportRequest, updateTime int64)

type SafeExpressionCache

type SafeExpressionCache struct {
	sync.RWMutex
	L []*model.NewExpression
}

func (*SafeExpressionCache) Get

func (this *SafeExpressionCache) Get() []*model.NewExpression

func (*SafeExpressionCache) Init

func (this *SafeExpressionCache) Init()

type SafeGitRepo

type SafeGitRepo struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*SafeGitRepo) Get

func (this *SafeGitRepo) Get() string

func (*SafeGitRepo) Init

func (this *SafeGitRepo) Init()

type SafeGroupPlugins

type SafeGroupPlugins struct {
	sync.RWMutex
	M map[int][]string
}

一个HostGroup可以绑定多个Plugin

func (*SafeGroupPlugins) GetPlugins

func (this *SafeGroupPlugins) GetPlugins(gid int) ([]string, bool)

func (*SafeGroupPlugins) Init

func (this *SafeGroupPlugins) Init()

type SafeGroupTemplates

type SafeGroupTemplates struct {
	sync.RWMutex
	M map[int][]int
}

一个HostGroup对应多个Template

func (*SafeGroupTemplates) GetTemplateIds

func (this *SafeGroupTemplates) GetTemplateIds(gid int) ([]int, bool)

func (*SafeGroupTemplates) Init

func (this *SafeGroupTemplates) Init()

type SafeHostGroupsMap

type SafeHostGroupsMap struct {
	sync.RWMutex
	M map[int][]int
}

一个机器可能在多个group下,做一个map缓存hostid与groupid的对应关系

func (*SafeHostGroupsMap) GetGroupIds

func (this *SafeHostGroupsMap) GetGroupIds(hid int) ([]int, bool)

func (*SafeHostGroupsMap) Init

func (this *SafeHostGroupsMap) Init()

type SafeHostMap

type SafeHostMap struct {
	sync.RWMutex
	M map[string]int
}

每次心跳的时候agent把hostname汇报上来,经常要知道这个机器的hostid,把此信息缓存 key: hostname value: hostid

func (*SafeHostMap) GetID

func (this *SafeHostMap) GetID(hostname string) (int, bool)

func (*SafeHostMap) Init

func (this *SafeHostMap) Init()

type SafeHostTemplateIds

type SafeHostTemplateIds struct {
	sync.RWMutex
	M map[int][]int
}

func (*SafeHostTemplateIds) GetMap

func (this *SafeHostTemplateIds) GetMap() map[int][]int

func (*SafeHostTemplateIds) Init

func (this *SafeHostTemplateIds) Init()

type SafeMonitoredHosts

type SafeMonitoredHosts struct {
	sync.RWMutex
	M map[int]*model.Host
}

func (*SafeMonitoredHosts) Get

func (this *SafeMonitoredHosts) Get() map[int]*model.Host

func (*SafeMonitoredHosts) Init

func (this *SafeMonitoredHosts) Init()

type SafeStrategies

type SafeStrategies struct {
	sync.RWMutex
	M map[int]*model.NewStrategy
}

func (*SafeStrategies) GetMap

func (this *SafeStrategies) GetMap() map[int]*model.NewStrategy

func (*SafeStrategies) Init

func (this *SafeStrategies) Init(tpls map[int]*model.NewTemplate)

type SafeTemplateCache

type SafeTemplateCache struct {
	sync.RWMutex
	M map[int]*model.NewTemplate
}

func (*SafeTemplateCache) GetMap

func (this *SafeTemplateCache) GetMap() map[int]*model.NewTemplate

func (*SafeTemplateCache) Init

func (this *SafeTemplateCache) Init()

Jump to

Keyboard shortcuts

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