control

package
v0.0.0-...-d050cfb Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2019 License: Apache-2.0, Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
}

Agent ...

type AlarmMsg

type AlarmMsg struct {
	AppName        string   // 应用名
	AgentID        string   // 应用ID
	Type           int      // 告警类型
	API            string   // api
	SQL            string   // sql
	ThresholdValue float64  // 阀值
	AlertValue     float64  // 告警值
	Channel        string   // 告警通道/告警工具
	Users          []string // 告警对象
	Time           int64    // 告警时间
	Interval       int64    // 告警间隔,单位秒
	IsRecovery     bool     //是否需要恢复告警
	Unit           string   // 单位
	ID             int64    // 告警id
}

AlarmMsg 告警信息

type Alert

type Alert struct {
	AlertTime    int64 // 告警时间
	RecoveryTime int64 // 恢复时间
	Count        int   // 告警次数
	// contains filtered or unexported fields
}

Alert 告警时间记录

type Api

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

Api api告警信息

type Apis

type Apis struct {
	sync.RWMutex
	Apis map[string]*Api
}

Apis ...

type App

type App struct {
	Apis    *Apis    // api告警信息缓存
	ExRatio *Alert   // 异常率信息缓存
	Sqls    *Sqls    // sql告警信息缓存
	Cpus    *Cpus    // cpuload
	Memorys *Memorys // memory
	// contains filtered or unexported fields
}

App ...

type Apps

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

Apps apps

type Channel

type Channel interface {
	AlertPush(msg *alert.Alert) error
}

Channel 通知工具

type Channels

type Channels struct {
	Channels map[string]Channel
}

Channels 通知工具集合

type Conf

type Conf struct {
	Channels      []string
	MaxAlarmCount int    // 最大告警次数
	AlarmInterval int64  // 两次告警时间间隔
	DetailAddr    string // apm 查询详情地址
	EmailURL      string // email服务url
	EmaiCentID    string // email centID
	EmailSubject  string // 邮件主题
	Mobileurl     string // mobile服务url
	MobileCentID  string // mobile centID
}

Conf config

type Control

type Control struct {
	Apps *Apps // 应用缓存
	// contains filtered or unexported fields
}

Control 告警控制中心

func New

func New(conf *Conf, zlog *zap.Logger) *Control

New new control

func (*Control) AddUser

func (c *Control) AddUser(id, email, mobile string)

AddUser ...

func (*Control) AlertPush

func (c *Control) AlertPush(msg *AlarmMsg) error

AlertPush 告警推送

func (*Control) Init

func (c *Control) Init(f func() *gocql.Session) error

Init init

type Cpu

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

Cpu ...

type Cpus

type Cpus struct {
	sync.RWMutex
	Agents map[string]*Cpu
}

Cpus ..

type Memory

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

Memory ...

type Memorys

type Memorys struct {
	sync.RWMutex
	Agents map[string]*Memory
}

Memorys ..

type Sql

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

Sql ...

type Sqls

type Sqls struct {
	sync.RWMutex
	Sqls map[string]*Sql
}

Sqls ...

type Users

type Users struct {
	sync.RWMutex
	Users map[string]*alert.User
}

Users users

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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