history

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: GPL-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RetentionStatements = []retentionStatement{{
	RetentionType: RetentionHistory,
	Category:      "acknowledgement",
	CleanupStmt: icingadb.CleanupStmt{
		Table:  "acknowledgement_history",
		PK:     "id",
		Column: "clear_time",
	},
}, {
	RetentionType: RetentionHistory,
	Category:      "comment",
	CleanupStmt: icingadb.CleanupStmt{
		Table:  "comment_history",
		PK:     "comment_id",
		Column: "remove_time",
	},
}, {
	RetentionType: RetentionHistory,
	Category:      "downtime",
	CleanupStmt: icingadb.CleanupStmt{
		Table:  "downtime_history",
		PK:     "downtime_id",
		Column: "end_time",
	},
}, {
	RetentionType: RetentionHistory,
	Category:      "flapping",
	CleanupStmt: icingadb.CleanupStmt{
		Table:  "flapping_history",
		PK:     "id",
		Column: "end_time",
	},
}, {
	RetentionType: RetentionHistory,
	Category:      "notification",
	CleanupStmt: icingadb.CleanupStmt{
		Table:  "notification_history",
		PK:     "id",
		Column: "send_time",
	},
}, {
	RetentionType: RetentionHistory,
	Category:      "state",
	CleanupStmt: icingadb.CleanupStmt{
		Table:  "state_history",
		PK:     "id",
		Column: "event_time",
	},
}, {
	RetentionType: RetentionSla,
	Category:      "sla_downtime",
	CleanupStmt: icingadb.CleanupStmt{
		Table:  "sla_history_downtime",
		PK:     "downtime_id",
		Column: "downtime_end",
	},
}, {
	RetentionType: RetentionSla,
	Category:      "sla_state",
	CleanupStmt: icingadb.CleanupStmt{
		Table:  "sla_history_state",
		PK:     "id",
		Column: "event_time",
	},
}}

RetentionStatements maps history categories with corresponding cleanup statements.

Functions

This section is empty.

Types

type Retention

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

Retention deletes rows from history tables that exceed their configured retention period.

func NewRetention

func NewRetention(
	db *icingadb.DB, historyDays uint64, slaDays uint64, interval time.Duration,
	count uint64, options RetentionOptions, logger *logging.Logger,
) *Retention

NewRetention returns a new Retention.

func (*Retention) Start

func (r *Retention) Start(ctx context.Context) error

Start starts the retention.

type RetentionOptions

type RetentionOptions map[string]uint64

RetentionOptions defines the non-default mapping of history categories with their retention period in days.

func (RetentionOptions) Validate

func (o RetentionOptions) Validate() error

Validate checks constraints in the supplied retention options and returns an error if they are violated.

type RetentionType

type RetentionType int
const (
	RetentionHistory RetentionType = iota
	RetentionSla
)

type Sync

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

Sync specifies the source and destination of a history sync.

func NewSync

func NewSync(db *icingadb.DB, redis *icingaredis.Client, logger *logging.Logger) *Sync

NewSync creates a new Sync.

func (Sync) Sync

func (s Sync) Sync(ctx context.Context) error

Sync synchronizes Redis history streams from s.redis to s.db and deletes the original data on success.

Jump to

Keyboard shortcuts

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