models

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	//GORM attributes, see: http://gorm.io/docs/conventions.html
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time

	WWN string `json:"wwn" gorm:"primary_key"`

	DeviceName     string `json:"device_name"`
	DeviceUUID     string `json:"device_uuid"`
	DeviceSerialID string `json:"device_serial_id"`
	DeviceLabel    string `json:"device_label"`

	Manufacturer   string `json:"manufacturer"`
	ModelName      string `json:"model_name"`
	InterfaceType  string `json:"interface_type"`
	InterfaceSpeed string `json:"interface_speed"`
	SerialNumber   string `json:"serial_number"`
	Firmware       string `json:"firmware"`
	RotationSpeed  int    `json:"rotational_speed"`
	Capacity       int64  `json:"capacity"`
	FormFactor     string `json:"form_factor"`
	SmartSupport   bool   `json:"smart_support"`
	DeviceProtocol string `json:"device_protocol"` //protocol determines which smart attribute types are available (ATA, NVMe, SCSI)
	DeviceType     string `json:"device_type"`     //device type is used for querying with -d/t flag, should only be used by collector.

	// User provided metadata
	Label  string `json:"label"`
	HostId string `json:"host_id"`

	// Data set by Scrutiny
	DeviceStatus pkg.DeviceStatus `json:"device_status"`
}

func (*Device) IsAta

func (dv *Device) IsAta() bool

func (*Device) IsNvme

func (dv *Device) IsNvme() bool

func (*Device) IsScsi

func (dv *Device) IsScsi() bool

func (*Device) UpdateFromCollectorSmartInfo

func (dv *Device) UpdateFromCollectorSmartInfo(info collector.SmartInfo) error

This function is called every time the collector sends SMART data to the API. It can be used to update device data that can change over time.

type DeviceSummary

type DeviceSummary struct {
	Device Device `json:"device"`

	SmartResults *SmartSummary                   `json:"smart,omitempty"`
	TempHistory  []measurements.SmartTemperature `json:"temp_history,omitempty"`
}

type DeviceSummaryWrapper

type DeviceSummaryWrapper struct {
	Success bool    `json:"success"`
	Errors  []error `json:"errors"`
	Data    struct {
		Summary map[string]*DeviceSummary `json:"summary"`
	} `json:"data"`
}

type DeviceWrapper

type DeviceWrapper struct {
	Success bool     `json:"success"`
	Errors  []error  `json:"errors"`
	Data    []Device `json:"data"`
}

type SettingEntry added in v0.5.0

type SettingEntry struct {
	//GORM attributes, see: http://gorm.io/docs/conventions.html
	gorm.Model

	SettingKeyName        string `json:"setting_key_name" gorm:"unique;not null"`
	SettingKeyDescription string `json:"setting_key_description"`
	SettingDataType       string `json:"setting_data_type"`

	SettingValueNumeric int    `json:"setting_value_numeric"`
	SettingValueString  string `json:"setting_value_string"`
	SettingValueBool    bool   `json:"setting_value_bool"`
}

SettingEntry matches a setting row in the database

func (SettingEntry) TableName added in v0.5.0

func (s SettingEntry) TableName() string

type Settings added in v0.5.0

type Settings struct {
	Theme            string `json:"theme" mapstructure:"theme"`
	Layout           string `json:"layout" mapstructure:"layout"`
	DashboardDisplay string `json:"dashboard_display" mapstructure:"dashboard_display"`
	DashboardSort    string `json:"dashboard_sort" mapstructure:"dashboard_sort"`
	TemperatureUnit  string `json:"temperature_unit" mapstructure:"temperature_unit"`
	FileSizeSIUnits  bool   `json:"file_size_si_units" mapstructure:"file_size_si_units"`
	LineStroke       string `json:"line_stroke" mapstructure:"line_stroke"`

	Metrics struct {
		NotifyLevel            int  `json:"notify_level" mapstructure:"notify_level"`
		StatusFilterAttributes int  `json:"status_filter_attributes" mapstructure:"status_filter_attributes"`
		StatusThreshold        int  `json:"status_threshold" mapstructure:"status_threshold"`
		RepeatNotifications    bool `json:"repeat_notifications" mapstructure:"repeat_notifications"`
	} `json:"metrics" mapstructure:"metrics"`
}

type SmartSummary

type SmartSummary struct {
	// Collector Summary Data
	CollectorDate time.Time `json:"collector_date,omitempty"`
	Temp          int64     `json:"temp,omitempty"`
	PowerOnHours  int64     `json:"power_on_hours,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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