zenoss

package
v1.7.0-rc5 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Whether Zenoss integration is enabled.
	Enabled bool `toml:"enabled" override:"enabled"`
	// Zenoss events API URL.
	URL string `toml:"url" override:"url"`
	// Zenoss authentication username.
	Username string `toml:"username" override:"username"`
	// Zenoss authentication password.
	Password string `toml:"password" override:"password,redact"`
	// Action (router name).
	Action string `toml:"action" override:"action"`
	// Router method.
	Method string `toml:"method" override:"method"`
	// Event type.
	Type string `toml:"type" override:"type"`
	// Event TID.
	TID int64 `toml:"tid" override:"tid"`
	// Collector name.
	Collector string `toml:"collector" override:"collector"`
	// Level to severity map.
	SeverityMap SeverityMap `toml:"severity-map" override:"severity-map"`
	// Whether all alerts should automatically post to Zenoss.
	Global bool `toml:"global" override:"global"`
	// Whether all alerts should automatically use stateChangesOnly mode.
	// Only applies if global is also set.
	StateChangesOnly bool `toml:"state-changes-only" override:"state-changes-only"`
}

func NewConfig

func NewConfig() Config

func (Config) Validate

func (c Config) Validate() error

type Diagnostic

type Diagnostic interface {
	WithContext(ctx ...keyvalue.T) Diagnostic
	Error(msg string, err error)
}

type Event

type Event struct {
	Action string                   `json:"action"`
	Method string                   `json:"method"`
	Data   []map[string]interface{} `json:"data"`
	Type   string                   `json:"type"`
	TID    int64                    `json:"tid"`
}

Event is a structure representing Zenoss event.

type EventData

type EventData struct {
	Summary    string      `json:"summary"`
	Device     string      `json:"device"`
	Component  string      `json:"component"`
	Severity   interface{} `json:"severity"`
	EvClassKey string      `json:"evclasskey"`
	EvClass    string      `json:"evclass"`
	Collector  string      `json:"collector,omitempty"`
	Message    string      `json:"message,omitempty"`
}

EventData represents Zenoss event data. All fields should be present in JSON.

type HandlerConfig

type HandlerConfig struct {
	// Action (router name).
	// If empty uses action from the configuration.
	Action string `mapstructure:"action"`

	// Router method.
	// If empty uses method from the configuration.
	Method string `mapstructure:"method"`

	// Event type.
	// If empty uses type from the configuration.
	Type string `mapstructure:"type"`

	// Event TID.
	// If empty uses TID from the configuration.
	TID int64 `mapstructure:"tid"`

	// Summary of the event.
	Summary string `json:"summary"`

	// Device related to the event.
	Device string `json:"device"`

	// Component related to the event.
	Component string `json:"component"`

	// Event Class Key of the event.
	EventClassKey string `json:"evclasskey"`

	// Event Class of the event.
	EventClass string `json:"evclass"`

	// Collector (typically IP or hostname).
	Collector string `json:"collector"`

	// Message related to the event.
	Message string `json:"message"`

	// Custom fields is a map of key value pairs.
	CustomFields map[string]interface{} `mapstructure:"customField"`
}

type Service

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

func NewService

func NewService(c Config, d Diagnostic) *Service

func (*Service) Alert

func (s *Service) Alert(state *alert.EventState, data *alert.EventData, hc *HandlerConfig) error

func (*Service) Close

func (s *Service) Close() error

func (*Service) Global

func (s *Service) Global() bool

func (*Service) Handler

func (s *Service) Handler(c HandlerConfig, ctx ...keyvalue.T) alert.Handler

func (*Service) Open

func (s *Service) Open() error

func (*Service) StateChangesOnly

func (s *Service) StateChangesOnly() bool

func (*Service) Test

func (s *Service) Test(options interface{}) error

func (*Service) TestOptions

func (s *Service) TestOptions() interface{}

func (*Service) Update

func (s *Service) Update(newConfig []interface{}) error

type SeverityMap

type SeverityMap struct {
	// OK level mapping to severity (number or string)
	OK interface{} `toml:"OK" json:"ok"`
	// Info level mapping to severity (number or string)
	Info interface{} `toml:"Info" json:"info"`
	// Warning level mapping to severity (number or string)
	Warning interface{} `toml:"Warning" json:"warning"`
	// Critical level mapping to severity (number or string)
	Critical interface{} `toml:"Critical" json:"critical"`
}

func (*SeverityMap) CustomMapStructure

func (s *SeverityMap) CustomMapStructure(m map[string]interface{}) error

Implements override.CustomMapStructurer because newer versions of github.com/mitchellh/mapstructure do not handle overwriting interface values inside structs with a new type.

func (*SeverityMap) ValueFor

func (s *SeverityMap) ValueFor(level alert.Level) interface{}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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