types

package
v0.8.18 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 4 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CustomPluginConfig

type CustomPluginConfig struct {
	// Plugin is the name of plugin which is currently used.
	// Currently supported: custom.
	Plugin string `json:"plugin,omitempty"`
	// PluginConfig is global plugin configuration.
	PluginGlobalConfig pluginGlobalConfig `json:"pluginConfig,omitempty"`
	// Source is the source name of the custom plugin monitor
	Source string `json:"source"`
	// DefaultConditions are the default states of all the conditions custom plugin monitor should handle.
	DefaultConditions []types.Condition `json:"conditions"`
	// Rules are the rules custom plugin monitor will follow to parse and invoke plugins.
	Rules []*CustomRule `json:"rules"`
	// EnableMetricsReporting describes whether to report problems as metrics or not.
	EnableMetricsReporting *bool `json:"metricsReporting,omitempty"`
}

Custom plugin config is the configuration of custom plugin monitor.

func (*CustomPluginConfig) ApplyConfiguration

func (cpc *CustomPluginConfig) ApplyConfiguration() error

ApplyConfiguration applies default configurations.

func (CustomPluginConfig) Validate

func (cpc CustomPluginConfig) Validate() error

Validate verifies whether the settings in CustomPluginConfig are valid.

type CustomRule

type CustomRule struct {
	// Type is the type of the problem.
	Type types.Type `json:"type"`
	// Condition is the type of the condition the problem triggered. Notice that
	// the Condition field should be set only when the problem is permanent, or
	// else the field will be ignored.
	Condition string `json:"condition"`
	// Reason is the short reason of the problem.
	Reason string `json:"reason"`
	// Path is the path to the custom plugin.
	Path string `json:"path"`
	// Args is the args passed to the custom plugin.
	Args []string `json:"args"`
	// Timeout is the timeout string for the custom plugin to execute.
	TimeoutString *string `json:"timeout"`
	// Timeout is the timeout for the custom plugin to execute.
	Timeout *time.Duration `json:"-"`
}

CustomRule describes how custom plugin monitor should invoke and analyze plugins.

type Result

type Result struct {
	Rule       *CustomRule
	ExitStatus Status
	Message    string
}

Result is the custom plugin check result returned by plugin.

type Status

type Status int
const (
	OK      Status = 0
	NonOK   Status = 1
	Unknown Status = 2
)

Jump to

Keyboard shortcuts

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