models

package
v1.12.2 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoRecord error.
	ErrNoRecord = errors.New("models: no matching record found")

	// ErrInvalidLimit error.
	ErrInvalidLimit = errors.New("models: invalid limit")
)
View Source
var SeriesTypes = []map[string]interface{}{
	{
		"name":  "Last 5 minutes",
		"value": Last5Minutes,
	},
	{
		"name":  "Last 15 minutes",
		"value": Last15Minutes,
	},
	{
		"name":  "Last 30 minutes",
		"value": Last30Minutes,
	},
	{
		"name":  "Last 1 hour",
		"value": Last1Hour,
	},
	{
		"name":  "Last 3 hours",
		"value": Last3Hours,
	},
	{
		"name":  "Last 6 hours",
		"value": Last6Hours,
	},
	{
		"name":  "Last 12 hours",
		"value": Last12Hours,
	},
	{
		"name":  "Last 24 hours",
		"value": Last24Hours,
	},
	{
		"name":  "Last 2 days",
		"value": Last2Days,
	},
	{
		"name":  "Last 7 days",
		"value": Last7Days,
	},
	{
		"name":  "Last 30 days",
		"value": Last30Days,
	},
}

Functions

This section is empty.

Types

type Alarm added in v1.4.0

type Alarm struct {
	CPU    float64 `redis:"cpu"`
	Memory float64 `redis:"memory"`
	Disk   float64 `redis:"disk"`
}

Alarm type.

type AlarmRepository added in v1.4.0

type AlarmRepository interface {
	Find(Probe) (*Alarm, error)
}

AlarmRepository type.

type Probe added in v1.5.0

type Probe string

Probe type.

type ProbeRepository added in v1.5.0

type ProbeRepository interface {
	FindAll() ([]Probe, error)
	FindLatestValues(Probe, int) ([]interface{}, *time.Time, error)
	HasHeartbeat(Probe) (bool, error)
	SetHeartbeat(Probe, int) error
	Delete(Probe) error
}

ProbeRepository type.

type ProcessSeries added in v1.12.0

type ProcessSeries []ProcessValue

ProcessSeries type.

type ProcessValue added in v1.12.0

type ProcessValue struct {
	Name string  `json:"name"`
	X    int64   `json:"x"`
	Y    float64 `json:"y"`
}

ProcessValue type.

type RedisAlarmRepository added in v1.4.0

type RedisAlarmRepository struct {
	RedisPool *redis.Pool
}

RedisAlarmRepository type.

func (*RedisAlarmRepository) Find added in v1.4.0

func (rar *RedisAlarmRepository) Find(probe Probe) (*Alarm, error)

Find function.

type RedisProbeRepository added in v1.5.0

type RedisProbeRepository struct {
	RedisPool *redis.Pool
}

RedisProbeRepository type.

func (*RedisProbeRepository) Delete added in v1.9.0

func (rpr *RedisProbeRepository) Delete(probe Probe) error

Delete function.

func (*RedisProbeRepository) FindAll added in v1.5.0

func (rpr *RedisProbeRepository) FindAll() ([]Probe, error)

FindAll function.

func (*RedisProbeRepository) FindLatestValues added in v1.8.0

func (rpr *RedisProbeRepository) FindLatestValues(probe Probe, limit int) ([]interface{}, *time.Time, error)

FindLatestValues function.

func (*RedisProbeRepository) HasHeartbeat added in v1.8.0

func (rpr *RedisProbeRepository) HasHeartbeat(probe Probe) (bool, error)

HasHeartbeat function.

func (*RedisProbeRepository) SetHeartbeat added in v1.8.0

func (rpr *RedisProbeRepository) SetHeartbeat(probe Probe, sleep int) error

SetHeartbeat function.

type RedisSeriesRepository

type RedisSeriesRepository struct {
	RedisPool *redis.Pool
}

RedisSeriesRepository type.

func (*RedisSeriesRepository) ChunkSize added in v1.6.1

func (rsr *RedisSeriesRepository) ChunkSize(seriesType SeriesType) int

ChunkSize function.

func (*RedisSeriesRepository) FindCPU

FindCPU function.

func (*RedisSeriesRepository) FindDisk

func (rsr *RedisSeriesRepository) FindDisk(probe Probe, seriesType SeriesType, path string) (Series, Series, Series, error)

FindDisk function.

func (*RedisSeriesRepository) FindDiskPaths

func (rsr *RedisSeriesRepository) FindDiskPaths(probe Probe) ([]string, error)

FindDiskPaths function.

func (*RedisSeriesRepository) FindLoad added in v1.12.0

func (rsr *RedisSeriesRepository) FindLoad(probe Probe, seriesType SeriesType) (Series, Series, Series, error)

FindLoad function.

func (*RedisSeriesRepository) FindMemory

FindMemory function.

type Series

type Series []Value

Series type.

type SeriesRepository

type SeriesRepository interface {
	FindCPU(Probe, SeriesType) (Series, Series, Series, ProcessSeries, ProcessSeries, ProcessSeries, error)
	FindMemory(Probe, SeriesType) (Series, Series, Series, ProcessSeries, ProcessSeries, ProcessSeries, error)
	FindLoad(Probe, SeriesType) (Series, Series, Series, error)
	FindDisk(Probe, SeriesType, string) (Series, Series, Series, error)
	FindDiskPaths(Probe) ([]string, error)
	ChunkSize(seriesType SeriesType) int
}

SeriesRepository type.

type SeriesType

type SeriesType string

SeriesType type.

const (
	// Last5Minutes series.
	Last5Minutes SeriesType = "last_5_minutes"

	// Last15Minutes series.
	Last15Minutes SeriesType = "last_15_minutes"

	// Last30Minutes series.
	Last30Minutes SeriesType = "last_30_minutes"

	// Last1Hour series.
	Last1Hour SeriesType = "last_1_hour"

	// Last3Hours series.
	Last3Hours SeriesType = "last_3_hours"

	// Last6Hours series.
	Last6Hours SeriesType = "last_6_hours"

	// Last12Hours series.
	Last12Hours SeriesType = "last_12_hours"

	// Last24Hours series.
	Last24Hours SeriesType = "last_24_hours"

	// Last2Days series.
	Last2Days SeriesType = "last_2_days"

	// Last7Days series.
	Last7Days SeriesType = "last_7_days"

	// Last30Days series.
	Last30Days SeriesType = "last_30_days"
)

type Value

type Value struct {
	X int64   `json:"x"`
	Y float64 `json:"y"`
}

Value type.

Jump to

Keyboard shortcuts

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