notifier

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SysenvMessageEvent

func SysenvMessageEvent(r *ghttp.Request)

Types

type Callback

type Callback func(state State)

type Notifier

type Notifier struct {
	RemindDuration time.Duration // 提醒周期,在此时间段内,将不会触发提醒
	// contains filtered or unexported fields
}

Notifier 监控通知器

func NewNotifier

func NewNotifier(remindDuration time.Duration) *Notifier

func (*Notifier) SetCallbacks

func (p *Notifier) SetCallbacks(alert, remind, repair Callback)

SetCallbacks 设置通知器的触发回调函数,在里面实现告警、提醒、修复的消息触发

func (*Notifier) Trigger

func (p *Notifier) Trigger(trigger bool)

Trigger 是否触发报警,内部重置状态

type State

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

func (*State) FromLastRemindedAt

func (p *State) FromLastRemindedAt() time.Duration

FromLastRemindedAt 获取上次提醒到现在的时间间隔

func (*State) FromSentAt

func (p *State) FromSentAt() time.Duration

FromSentAt 获取首次触发到现在的时间间隔

func (*State) LastRemindedAt

func (p *State) LastRemindedAt() time.Time

LastRemindedAt 获取上一次提醒的时间

func (*State) SentAt

func (p *State) SentAt() time.Time

SentAt 获取首次触发的时间

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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