types

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AliveStatus

type AliveStatus string

AliveStatus is aliveness of plugin.

const (
	AliveStatusUp   AliveStatus = "UP"
	AliveStatusDown AliveStatus = "DOWN"
)

AliveStatus is type that describes aliveness flags.

type Channel

type Channel string

Channel types for dispatchers.

const (
	Discord   Channel = "DISCORD"
	Telegram  Channel = "TELEGRAM"
	PagerDuty Channel = "PAGERDUTY"
	Slack     Channel = "SLACK"
)

the type of channel.

type CronTabSt

type CronTabSt struct {
	Crontab  *cron.Cron `json:"crontab"`
	EntityID int        `json:"entity_id"`
}

CronTabSt is crontab structure.

func (*CronTabSt) Update

func (in *CronTabSt) Update(entity int)

Update is to update CronTabSt.

type DiscordColor

type DiscordColor int

DiscordColor is color for a discord alert.

type DiscordMsg

type DiscordMsg struct {
	Username  string  `json:"username,omitempty"`
	AvatarURL string  `json:"avatar_url,omitempty"`
	Content   string  `json:"content,omitempty"`
	Embeds    []Embed `json:"embeds"`
}

DiscordMsg is type for sending messages to a discord.

type Embed

type Embed struct {
	Author struct {
		Name    string `json:"name,omitempty"`
		URL     string `json:"url,omitempty"`
		IconURL string `json:"icon_url,omitempty"`
	} `json:"author,omitempty"`
	Title       string       `json:"title"`
	URL         string       `json:"url,omitempty"`
	Timestamp   time.Time    `json:"timestamp"`
	Description string       `json:"description"`
	Color       DiscordColor `json:"color"`
	Fields      []Field      `json:"fields,omitempty"`
	Thumbnail   struct {
		URL string `json:"url,omitempty"`
	} `json:"thumbnail,omitempty"`
	Image struct {
		URL string `json:"url,omitempty"`
	} `json:"image,omitempty"`
	Footer struct {
		Text    string `json:"text,omitempty"`
		IconURL string `json:"icon_url,omitempty"`
	} `json:"footer,omitempty"`
}

Embed is information for a detailed message.

type Field

type Field struct {
	Name   string `json:"name,omitempty"`
	Value  string `json:"value,omitempty"`
	Inline bool   `json:"inline,omitempty"`
}

Field is a structure for embeds that can be omitted.

type Initializer

type Initializer string
const (
	TEST Initializer = "TEST"
	LIVE Initializer = "LIVE"
)

type NotifyInfo

type NotifyInfo struct {
	Plugin     string            `json:"plugin"`
	Method     string            `json:"method"`
	Address    string            `json:"address"`
	Port       int               `json:"port"`
	Severity   pluginpb.SEVERITY `json:"severity"`
	State      pluginpb.STATE    `json:"state"`
	ExecuteMsg string            `json:"execute_msg"`
}

NotifyInfo contains detail dispatcher configs.

type PluginStatus

type PluginStatus struct {
	Plugin    config.Plugin `json:"plugin"`
	IsAlive   AliveStatus   `json:"is_alive"`
	LastCheck time.Time     `json:"last_check"`
}

PluginStatus describes detail status of plugin.

type Reminder

type Reminder string

Reminder is for reminnig alert.

const (
	ON   Reminder = "ON"
	HANG Reminder = "HANG"
	OFF  Reminder = "OFF"
)

The type of Reminder.

type ReqMsg

type ReqMsg struct {
	FuncName     string                 `json:"func_name"`
	State        pluginpb.STATE         `json:"state"`
	Msg          string                 `json:"msg"`
	Severity     pluginpb.SEVERITY      `json:"severity"`
	ResourceType string                 `json:"resource_type"`
	Options      map[string]interface{} `json:"options"`
}

ReqMsg is Setup message into GRPC Type.

func (*ReqMsg) UpdateMSG

func (r *ReqMsg) UpdateMSG(message string)

UpdateMSG is to update message.

func (*ReqMsg) UpdateSeverity

func (r *ReqMsg) UpdateSeverity(sev pluginpb.SEVERITY)

UpdateSeverity is to uptade the severity of pluginpb.

func (*ReqMsg) UpdateState

func (r *ReqMsg) UpdateState(stat pluginpb.STATE)

UpdateState is to uptade the state of pluginpb.

type StateFlag

type StateFlag struct {
	State    pluginpb.STATE    `json:"state"`
	Severity pluginpb.SEVERITY `json:"severity"`
}

StateFlag is type that indicates the status of the plugins.

Jump to

Keyboard shortcuts

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