snapshot

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2021 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const SynologyConf = "/etc/synoinfo.conf"

Variables

View Source
var (
	ErrPlatformUnsup = fmt.Errorf("the requested metric is not available on this platform, " +
		"if you know how to collect it, please open an issue on the github repo")
	ErrNonZeroExit = fmt.Errorf("cmd exited non-zero")
)

Errors this package generates.

View Source
var ErrNoDisks = fmt.Errorf("no disks found")

Functions

This section is empty.

Types

type Config

type Config struct {
	Timeout   cnfg.Duration `toml:"timeout" xml:"timeout"`                     // total run time allowed.
	Interval  cnfg.Duration `toml:"interval" xml:"interval"`                   // how often to send snaps (cron).
	ZFSPools  []string      `toml:"zfs_pools" xml:"zfs_pool"`                  // zfs pools to monitor.
	UseSudo   bool          `toml:"use_sudo" xml:"use_sudo"`                   // use sudo for smartctl commands.
	Raid      bool          `toml:"monitor_raid" xml:"monitor_raid"`           // include mdstat and/or megaraid.
	DriveData bool          `toml:"monitor_drives" xml:"monitor_drives"`       // smartctl commands.
	DiskUsage bool          `toml:"monitor_space" xml:"monitor_space"`         // get disk usage.
	Uptime    bool          `toml:"monitor_uptime" xml:"monitor_uptime"`       // all system stats.
	CPUMem    bool          `toml:"monitor_cpuMemory" xml:"monitor_cpuMemory"` // cpu perct and memory used/free.
	CPUTemp   bool          `toml:"monitor_cpuTemp" xml:"monitor_cpuTemp"`     // not everything supports temps.
	// contains filtered or unexported fields
}

Config determines which checks to run, etc.

func (*Config) GetSnapshot

func (c *Config) GetSnapshot() (*Snapshot, []error, []error)

GetSnapshot returns a system snapshot based on requested data in the config.

func (*Config) Validate

func (c *Config) Validate()

type Partition

type Partition struct {
	Device string `json:"name"`
	Total  uint64 `json:"total"`
	Free   uint64 `json:"free"`
}

Partition is used for ZFS pools as well as normal Disk arrays.

type RaidData

type RaidData struct {
	MDstat  string            `json:"mdstat,omitempty"`
	MegaCLI map[string]string `json:"megacli,omitempty"`
}

RaidData contains raid information from mdstat and/or megacli.

type Snapshot

type Snapshot struct {
	Version string
	Uptime  time.Duration
	System  struct {
		*host.InfoStat
		Username string             `json:"username"`
		CPU      float64            `json:"cpuPerc"`
		MemFree  uint64             `json:"memFree"`
		MemUsed  uint64             `json:"memUsed"`
		MemTotal uint64             `json:"memTotal"`
		Temps    map[string]float64 `json:"temperatures,omitempty"`
		Users    int                `json:"users"`
		*load.AvgStat
	} `json:"system"`
	Raid       *RaidData             `json:"raid,omitempty"`
	DriveAges  map[string]int        `json:"driveAges,omitempty"`
	DriveTemps map[string]int        `json:"driveTemps,omitempty"`
	DiskUsage  map[string]*Partition `json:"diskUsage,omitempty"`
	DiskHealth map[string]string     `json:"driveHealth,omitempty"`
	ZFSPool    map[string]*Partition `json:"zfsPools,omitempty"`
	// contains filtered or unexported fields
}

Snapshot is the output data sent to Notifiarr.

func (*Snapshot) GetCPUSample

func (s *Snapshot) GetCPUSample(ctx context.Context, run bool) error

func (*Snapshot) GetLocalData

func (s *Snapshot) GetLocalData(ctx context.Context, run bool) (errs []error)

func (*Snapshot) GetMemoryUsage

func (s *Snapshot) GetMemoryUsage(ctx context.Context, run bool) error

func (*Snapshot) GetSynology

func (s *Snapshot) GetSynology(run bool) error

func (*Snapshot) GetUsers

func (s *Snapshot) GetUsers(ctx context.Context) error

type Synology

type Synology struct {
	Build   string `json:"last_admin_login_build"` // 254263
	Manager string `json:"manager"`                // Synology DiskStation
	Vendor  string `json:"vender"`                 // Synology Inc.
	Model   string `json:"upnpmodelname"`          // DS1517+
	Version string `json:"udc_check_state"`        // 6.2.3
}

Jump to

Keyboard shortcuts

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