monitor

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package monitor is the alerting engine. It watches container state (Docker events), resource usage (polled stats), restart frequency, and log output, evaluates user-defined rules, and dispatches matches to the in-app feed and configured webhooks. It also maintains a stats snapshot for the Prometheus exporter.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SendMail

func SendMail(cfg store.SMTPConfig, subject, body string) error

SendMail delivers one message via the configured SMTP server. It supports implicit TLS (cfg.TLS, e.g. port 465) and otherwise lets net/smtp negotiate STARTTLS when the server offers it. Exported so the API can send a test mail.

Types

type ContainerStat

type ContainerStat struct {
	HostID     int64
	HostName   string
	ID         string
	Name       string
	State      string
	CPUPercent float64
	MemBytes   uint64
	MemPercent float64
}

ContainerStat is the cached per-container snapshot used by the exporter.

type Monitor

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

Monitor is the long-running alert engine.

func New

func New(st *store.Store, dm *docker.Manager, hist history.Store) *Monitor

New builds a Monitor. hist may be nil to disable history recording.

func (*Monitor) Run

func (m *Monitor) Run(ctx context.Context)

Run starts all background loops and blocks until ctx is cancelled.

func (*Monitor) Snapshot

func (m *Monitor) Snapshot() []ContainerStat

Snapshot returns a copy of the latest per-container stats for the exporter.

Jump to

Keyboard shortcuts

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