journalalerts

package
v0.0.0-...-d5bc497 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: Apache-2.0 Imports: 14 Imported by: 4

Documentation

Overview

Package alerts provides set of API to send system and services alerts

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertSender

type AlertSender interface {
	SendAlert(alert interface{})
}

AlertSender alerts sender.

type Config

type Config struct {
	Filter               []string `json:"filter"`
	ServiceAlertPriority int      `json:"serviceAlertPriority"`
	SystemAlertPriority  int      `json:"systemAlertPriority"`
}

Config alerts configuration.

type CursorStorage

type CursorStorage interface {
	SetJournalCursor(cursor string) (err error)
	GetJournalCursor() (cursor string, err error)
}

CursorStorage provides API to set and get journal cursor.

type InstanceInfoProvider

type InstanceInfoProvider interface {
	GetInstanceInfoByID(instanceID string) (ident aostypes.InstanceIdent, version string, err error)
}

InstanceInfoProvider provides instance info.

type JournalAlerts

type JournalAlerts struct {
	sync.Mutex
	// contains filtered or unexported fields
}

JournalAlerts instance.

func New

func New(
	config Config, instanceProvider InstanceInfoProvider, cursorStorage CursorStorage, sender AlertSender,
) (instance *JournalAlerts, err error)

New creates new journal alerts object.

func (*JournalAlerts) Close

func (instance *JournalAlerts) Close()

Close closes logging.

type JournalInterface

type JournalInterface interface {
	Close() error
	AddMatch(match string) error
	AddDisjunction() error
	SeekTail() error
	Previous() (uint64, error)
	SeekCursor(cursor string) error
	Next() (uint64, error)
	GetEntry() (*sdjournal.JournalEntry, error)
	Wait(timeout time.Duration) int
	GetCursor() (string, error)
}

JournalInterface systemd journal interface.

var SDJournal JournalInterface //nolint:gochecknoglobals

SDJournal is using to mock systemd journal in unit tests.

Jump to

Keyboard shortcuts

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