dao

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Conf  *model.Config
	Cache *cache.Cache
	DB    *gorm.DB

	ServerList map[uint64]*model.Server
	SecretToID map[string]uint64
	ServerLock sync.RWMutex

	SortedServerList []*model.Server
	SortedServerLock sync.RWMutex
)
View Source
var Alerts []*model.AlertRule
View Source
var AlertsCycleTransferStatsStore map[uint64]*model.CycleTransferStats
View Source
var AlertsLock sync.RWMutex

报警规则

View Source
var Cron *cron.Cron
View Source
var CronLock sync.RWMutex
View Source
var Crons map[uint64]*model.Cron
View Source
var Version = "v0.12.2" // !!记得修改 README 中的 badge 版本!!

Functions

func AlertSentinelStart

func AlertSentinelStart()

func CronTrigger

func CronTrigger(cr model.Cron) func()

func LoadNotifications added in v0.10.3

func LoadNotifications()

func ManualTrigger added in v0.7.1

func ManualTrigger(c model.Cron)

func NewServiceSentinel added in v0.4.11

func NewServiceSentinel(serviceSentinelDispatchBus chan<- model.Monitor)

func OnDeleteAlert

func OnDeleteAlert(id uint64)

func OnDeleteNotification

func OnDeleteNotification(id uint64)

func OnRefreshOrAddAlert

func OnRefreshOrAddAlert(alert model.AlertRule)

func OnRefreshOrAddNotification

func OnRefreshOrAddNotification(n model.Notification)

func ReSortServer

func ReSortServer()

func SendNotification

func SendNotification(desc string, muteable bool)

Types

type NotificationHistory

type NotificationHistory struct {
	Duration time.Duration
	Until    time.Time
}

type ReportData added in v0.4.11

type ReportData struct {
	Data     *pb.TaskResult
	Reporter uint64
}

type ServiceSentinel added in v0.4.11

type ServiceSentinel struct {
	// contains filtered or unexported fields
}

使用缓存 channel,处理上报的 Service 请求结果,然后判断是否需要报警 需要记录上一次的状态信息

var ServiceSentinelShared *ServiceSentinel

func (*ServiceSentinel) Dispatch added in v0.4.11

func (ss *ServiceSentinel) Dispatch(r ReportData)

func (*ServiceSentinel) LoadStats added in v0.4.11

func (ss *ServiceSentinel) LoadStats() map[uint64]*model.ServiceItemResponse

func (*ServiceSentinel) Monitors added in v0.4.11

func (ss *ServiceSentinel) Monitors() []*model.Monitor

func (*ServiceSentinel) OnMonitorDelete added in v0.4.11

func (ss *ServiceSentinel) OnMonitorDelete(id uint64)

func (*ServiceSentinel) OnMonitorUpdate added in v0.4.11

func (ss *ServiceSentinel) OnMonitorUpdate(m model.Monitor) error

Jump to

Keyboard shortcuts

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