module

package
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: Apache-2.0 Imports: 20 Imported by: 1

Documentation

Overview

TODO: 实现gitlab ci images功能,实现容器化运行pipeline 1. 远程docker执行images功能 2. kubernetes集群执行images功能

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHookAdapter

func NewHookAdapter(in HookMethod) *hook

hook适配器

Types

type Alert

type Alert interface {
	Send(*plugin.Message)
}

对外接口

type CliInput

type CliInput struct {
	LifeCycle
	// contains filtered or unexported fields
}

func (*CliInput) Init

func (c *CliInput) Init(data interface{})

LocalYamlInput的Init函数实现

func (*CliInput) Receive

func (c *CliInput) Receive() *plugin.Message

func (*CliInput) SetConnectStatus

func (c *CliInput) SetConnectStatus(ip, status string)

func (*CliInput) Start

func (c *CliInput) Start()

type ConsoleOutput

type ConsoleOutput struct {
	LifeCycle
	// contains filtered or unexported fields
}

Console output插件,将消息输出到控制台上

func (*ConsoleOutput) Init

func (c *ConsoleOutput) Init(data interface{})

func (*ConsoleOutput) Send

func (c *ConsoleOutput) Send(msgs *plugin.Message)

type Consumer

type Consumer interface {
	Poll() *Records
}

type Email

type Email struct {
	Sid      string   `json:"sid"`
	From     string   `json:"from"`
	Name     string   `json:"name"`
	To       []string `json:"to"`
	Smtp     string   `json:"smtp"`
	SmtpPort int      `json:"smtpport"`
	Pwd      string   `json:"pwd"`
	Subject  string   `json:"subject"`
	Body     string   `json:"body"`
	Range    string   `json:"range"` // 启动时间
}

func NewEmail

func NewEmail(data map[interface{}]interface{}, msg *plugin.Message, vars map[string]interface{}) (*Email, error)

func (*Email) IsCurrent

func (this *Email) IsCurrent() bool

'range': '星期一,星期二,星期三,星期四,星期五,星期六,星期天|01:05-23:59' 'range': '|00:00-23:59' 'range': '-'

func (*Email) SpecificSend

func (this *Email) SpecificSend() (string, error)

type HelloInput

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

Hello input插件,接收“Hello World”消息

func (*HelloInput) Init

func (h *HelloInput) Init(data interface{})

func (*HelloInput) Receive

func (h *HelloInput) Receive() *plugin.Message

func (*HelloInput) Start

func (h *HelloInput) Start()

func (*HelloInput) Status

func (h *HelloInput) Status() plugin.StatusPlugin

func (*HelloInput) Stop

func (h *HelloInput) Stop()

type HookMethod

type HookMethod interface {
	SpecificSend() (string, error)
	IsCurrent() bool // 判断当前是否可以发送告警信
}

对内实现

type KafkaInput

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

将上面原始struct转换成目标struct KafkaInput 重点:转换 特殊功能:添加Plugin Func

func (*KafkaInput) Init

func (k *KafkaInput) Init(data interface{})

KakkaInput的Init函数实现

func (*KafkaInput) Receive

func (k *KafkaInput) Receive() *plugin.Message

func (*KafkaInput) Start

func (k *KafkaInput) Start()

func (*KafkaInput) Status

func (k *KafkaInput) Status() plugin.StatusPlugin

func (*KafkaInput) Stop

func (k *KafkaInput) Stop()

type LifeCycle

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

功能:设置默认Start|Stop|Status 实现Filter Interface

func (*LifeCycle) Start

func (l *LifeCycle) Start()

func (*LifeCycle) Status

func (l *LifeCycle) Status() plugin.StatusPlugin

func (*LifeCycle) Stop

func (l *LifeCycle) Stop()

type LocalYaml

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

func (*LocalYaml) Get

func (l *LocalYaml) Get()

type LocalYamlInput

type LocalYamlInput struct {
	LifeCycle
	// contains filtered or unexported fields
}

func (*LocalYamlInput) Init

func (l *LocalYamlInput) Init(data interface{})

LocalYamlInput的Init函数实现

func (*LocalYamlInput) Receive

func (l *LocalYamlInput) Receive() *plugin.Message

func (*LocalYamlInput) SetConnectStatus

func (l *LocalYamlInput) SetConnectStatus(ip, status string)

func (*LocalYamlInput) Start

func (l *LocalYamlInput) Start()

type MockConsumer

type MockConsumer struct{}

上述代码中的kafka.MockConsumer为我们模式Kafka消费者的一个实现,代码如下

func (*MockConsumer) Poll

func (m *MockConsumer) Poll() *Records

type Records

type Records struct {
	Items []string
}

原始struct

type ShellFilter

type ShellFilter struct {
	LifeCycle
	// contains filtered or unexported fields
}

shell 命令运行filter插件

func (*ShellFilter) Init

func (s *ShellFilter) Init(data interface{})

func (*ShellFilter) Process

func (s *ShellFilter) Process(msgs *plugin.Message) *plugin.Message

type SshCheck

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

ssh主机check插件

func (*SshCheck) Conn

func (s *SshCheck) Conn() *plugin.Message

连接目标主机22端口进行测试

func (*SshCheck) Init

func (s *SshCheck) Init(data interface{})

func (*SshCheck) Start

func (s *SshCheck) Start()

func (*SshCheck) Status

func (s *SshCheck) Status() plugin.StatusPlugin

func (*SshCheck) Stop

func (s *SshCheck) Stop()

type Text

type Text struct {
	Content string `json:"content"`
}

type UpperFilter

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

Upper filter插件,将消息全部字母转成大写

func (*UpperFilter) Init

func (u *UpperFilter) Init(data interface{})

func (*UpperFilter) Process

func (u *UpperFilter) Process(msgs *plugin.Message) *plugin.Message

func (*UpperFilter) Start

func (u *UpperFilter) Start()

func (*UpperFilter) Status

func (u *UpperFilter) Status() plugin.StatusPlugin

func (*UpperFilter) Stop

func (u *UpperFilter) Stop()

type Wechat

type Wechat struct {
	Sid         string   `json:"sid"`
	Msgtype     string   `json:"msgtype"`
	Articles    string   `json:"articles"`
	Title       string   `json:"title"`
	Description string   `json:"description"`
	Url         string   `json:"url"`
	Picurl      string   `json:"picurl"`
	Text        Text     `json:"text"`
	Address     []string `json:"address"`
	Markdown    Text     `json:"markdown"`
	Origin      string
	Range       string `json:"range"`
}

func NewWechat

func NewWechat(data map[interface{}]interface{}, msg *plugin.Message, vars map[string]interface{}) (*Wechat, error)

func (*Wechat) IsCurrent

func (this *Wechat) IsCurrent() bool

func (*Wechat) SpecificSend

func (this *Wechat) SpecificSend() (string, error)

func (*Wechat) String

func (this *Wechat) String() string

转换成string

Jump to

Keyboard shortcuts

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