Documentation
¶
Overview ¶
Package reports writes capacity, inventory and backup-compliance reports from facts the API collects on every cluster member, keeps them in -state-dir/reports, and runs report schedules (ADR-0030, made real in ADR-0032). Reports only state what was measured: a number VirtoMir does not know is left out, never estimated.
Index ¶
- type Backup
- type BackupSchedule
- type CapacityData
- type Facts
- type Format
- type HostCompliance
- type HostFacts
- type InventoryItem
- type Kind
- type Machine
- type Meta
- type Pool
- type SLAItem
- type Schedule
- type ShowbackBuilder
- type Store
- func (s *Store) Delete(id string) error
- func (s *Store) DeleteSchedule(id string) error
- func (s *Store) Due(since time.Time) []Schedule
- func (s *Store) Generate(kind Kind, format Format, f Facts, by, scheduleID string) (Meta, error)
- func (s *Store) Get(id string) (Meta, []byte, error)
- func (s *Store) List() []Meta
- func (s *Store) PutSchedule(sc Schedule) (Schedule, error)
- func (s *Store) Ran(id string, err error)
- func (s *Store) Schedules() []Schedule
- func (s *Store) SetShowbackBuilder(fn ShowbackBuilder)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackupSchedule ¶
type BackupSchedule struct {
DomainUUID string `json:"domainUuid"`
Interval time.Duration `json:"interval"`
}
BackupSchedule is how often a machine is backed up automatically.
type CapacityData ¶
type CapacityData struct {
Hosts []capRow `json:"hosts"`
Total capRow `json:"total"`
Pools []Pool `json:"pools"`
}
CapacityData is the capacity report's JSON form.
type Facts ¶
type Facts struct {
Hosts []HostFacts `json:"hosts"`
// Missing names members that did not answer; their machines are not in the report.
Missing []string `json:"missing,omitempty"`
Compliance []HostCompliance `json:"compliance,omitempty"`
}
Facts is what the reports are made of: one entry per cluster member that answered.
type HostCompliance ¶ added in v0.9.0
type HostCompliance = compliance.HostCompliance
type HostFacts ¶
type HostFacts struct {
Name string `json:"name"`
CPUs int `json:"cpus"`
MemoryKiB uint64 `json:"memoryKiB"`
Machines []Machine `json:"machines"`
Pools []Pool `json:"pools"`
Backups []Backup `json:"backups"`
Schedules []BackupSchedule `json:"schedules"`
Compliance *HostCompliance `json:"compliance,omitempty"`
}
type InventoryItem ¶
InventoryItem is one machine of the inventory report.
type Machine ¶
type Machine struct {
UUID string `json:"uuid"`
Name string `json:"name"`
State string `json:"state"`
Owner string `json:"owner,omitempty"`
VCPUs int `json:"vcpus"`
MemoryMiB uint64 `json:"memoryMiB"`
DiskBytes uint64 `json:"diskBytes"` // capacity of its disks (CD-ROMs not counted)
Disks int `json:"disks"`
Addresses []string `json:"addresses,omitempty"`
Autostart bool `json:"autostart"`
Template bool `json:"template"`
}
type Meta ¶
type Meta struct {
ID string `json:"id"`
Kind Kind `json:"kind"`
Title string `json:"title"`
Format Format `json:"format"`
GeneratedAt time.Time `json:"generatedAt"`
SizeBytes int64 `json:"sizeBytes"`
Summary string `json:"summary"`
// By is who asked for it, or "schedule: <name>".
By string `json:"by"`
ScheduleID string `json:"scheduleId,omitempty"`
}
Meta describes one stored report.
type SLAItem ¶
type SLAItem struct {
Machine string `json:"machine"`
UUID string `json:"uuid"`
Host string `json:"host"`
Status string `json:"status"` // ok, late, overdue, never, unscheduled
LastBackup *time.Time `json:"lastBackup,omitempty"`
AgeHours float64 `json:"ageHours,omitempty"`
Backups int `json:"backups"`
SizeBytes uint64 `json:"sizeBytes"` // all of its backups
// Interval is its backup schedule ("" without one).
Interval string `json:"interval,omitempty"`
}
SLAItem is one machine of the backup compliance report.
type Schedule ¶
type Schedule struct {
ID string `json:"id"`
Name string `json:"name"`
Kind Kind `json:"kind"`
Format Format `json:"format"`
Enabled bool `json:"enabled"`
// Every: "daily", "weekly" (Mondays) or "monthly" (on the 1st), at At ("HH:MM", local).
Every string `json:"every"`
At string `json:"at"`
// KeepDays deletes this schedule's reports older than that (0: keep all).
KeepDays int `json:"keepDays"`
// Notify sends the summary through the alert channels (webhook, email) when done.
Notify bool `json:"notify"`
LastRun *time.Time `json:"lastRun,omitempty"`
LastError string `json:"lastError,omitempty"`
NextRun *time.Time `json:"nextRun,omitempty"` // computed
}
Schedule makes a report regularly.
type ShowbackBuilder ¶ added in v0.9.0
ShowbackBuilder builds a showback report body for one period. The API layer wires one up from the catalog package so schedules can name the showback kind like any other report.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) DeleteSchedule ¶
func (*Store) Due ¶
Due returns the enabled schedules whose next run after their last run (or after since, when they never ran) has come.
func (*Store) PutSchedule ¶
PutSchedule adds (no ID) or replaces a schedule.
func (*Store) SetShowbackBuilder ¶ added in v0.9.0
func (s *Store) SetShowbackBuilder(fn ShowbackBuilder)
SetShowbackBuilder registers (or clears, with nil) the showback builder.