event

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2025 License: GPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSuperfluousMuteUnmuteEvent = errors.New("ignoring superfluous (un)mute event")

ErrSuperfluousMuteUnmuteEvent indicates that a superfluous mute or unmute event is being ignored and is triggered when trying to mute/unmute an already muted/unmuted incident.

View Source
var ErrSuperfluousStateChange = errors.New("ignoring superfluous state change")

ErrSuperfluousStateChange indicates a superfluous state change being ignored and stopping further processing.

Functions

This section is empty.

Types

type Event

type Event struct {
	Time     time.Time `json:"-"`
	SourceId int64     `json:"-"`
	ID       int64     `json:"-"`

	baseEv.Event `json:",inline"`
}

Event received of a specified Type for internal processing.

This is a representation of an event received from an external source with additional metadata with sole purpose of being used for internal processing. All the JSON serializable fields are these inherited from the base event type, and are used to decode the request body. Currently, there is no Event being marshalled into its JSON representation.

func (*Event) CompleteURL added in v0.2.0

func (e *Event) CompleteURL(icingaWebBaseUrl string)

CompleteURL prefixes the URL with the given Icinga Web 2 base URL unless it already carries a URL or is empty.

func (*Event) FullString

func (e *Event) FullString() string

func (*Event) SetMute

func (e *Event) SetMute(muted bool, reason string)

SetMute alters the event mute and mute reason.

func (*Event) String

func (e *Event) String() string

func (*Event) Sync

func (e *Event) Sync(ctx context.Context, tx *sqlx.Tx, db *database.DB, objectId types.Binary) error

Sync transforms this event to *event.EventRow and synchronises with the database.

func (*Event) Validate

func (e *Event) Validate() error

Validate validates the current event state. Returns an error if it detects a misconfigured field.

type EventRow

type EventRow struct {
	ID         int64           `db:"id"`
	Time       types.UnixMilli `db:"time"`
	ObjectID   types.Binary    `db:"object_id"`
	Type       types.String    `db:"type"`
	Severity   baseEv.Severity `db:"severity"`
	Username   types.String    `db:"username"`
	Message    types.String    `db:"message"`
	Mute       types.Bool      `db:"mute"`
	MuteReason types.String    `db:"mute_reason"`
}

EventRow represents a single event database row and isn't an in-memory representation of an event.

func NewEventRow

func NewEventRow(e *Event, objectId types.Binary) *EventRow

func (*EventRow) TableName

func (er *EventRow) TableName() string

TableName implements the contracts.TableNamer interface.

Jump to

Keyboard shortcuts

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