internal

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2022 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PanelVersion = "0.0.1"

	DefaultLanguage               = "en"
	DefaultLogLevel               = logrus.DebugLevel
	DefaultAddr                   = "0.0.0.0"
	DefaultPort                   = "7777"
	DefaultDashboardUpdateTimeout = time.Second * 1
)

Variables

View Source
var (
	DefaultConfigPath   = os.Getenv("HOME") + "/.config/control-panel/"
	DefaultSettingsFile = "settings"
)

Functions

func GetCPUInfo

func GetCPUInfo() ([]cpu.InfoStat, error)

GetCPUInfo returns cpu info

func GetCPULoad

func GetCPULoad() (*structures.CPULoad, error)

GetCPULoad returns cpu load

func GetCPUTimes

func GetCPUTimes() ([]cpu.TimesStat, error)

GetCPUTimes GetCpuTimes returns cpu times

func GetDiskIO

func GetDiskIO() ([]io.Stats, error)

GetDiskIO returns disk usage

func GetDiskInfo

func GetDiskInfo(path string) (*structures.UsageStat, error)

GetDiskInfo returns disk info

func GetDiskPartitions

func GetDiskPartitions() ([]structures.PartitionStat, error)

GetDiskPartitions returns disk partitions

func GetVirtualMemory

func GetVirtualMemory() (*structures.Memory, error)

GetVirtualMemory returns virtual memory info

Types

type PanelSettings

type PanelSettings struct {
	Addr                   string        `json:"addr"`
	Port                   string        `json:"port"`
	LogLevel               logrus.Level  `json:"log_level"`
	Language               string        `json:"language"`
	DashboardUpdateTimeout time.Duration `json:"dashboard_update_timeout"`
	// contains filtered or unexported fields
}

PanelSettings port - the port on which the panel will work logLevel - the debug level of the panel language - panel language DashboardUpdateTimeout - the timeout of updates dashboard

func DefaultPanelSettings

func DefaultPanelSettings() *PanelSettings

DefaultPanelSettings ErrorLevels: panic fatal error warning info debug trace

func NewPanelSettings

func NewPanelSettings(settingsPath string) (*PanelSettings, error)

func (*PanelSettings) GetAddr

func (p *PanelSettings) GetAddr() string

func (*PanelSettings) GetDashboardUpdateTimeout

func (p *PanelSettings) GetDashboardUpdateTimeout() time.Duration

func (*PanelSettings) GetLanguage

func (p *PanelSettings) GetLanguage() string

func (*PanelSettings) GetLogLevel

func (p *PanelSettings) GetLogLevel() string

func (*PanelSettings) GetPort

func (p *PanelSettings) GetPort() string

func (*PanelSettings) GetSettings

func (p *PanelSettings) GetSettings() (*PanelSettings, error)

GetSettings returns the settings if the settings are not found, it will save and return default settings

func (*PanelSettings) ResetSettings

func (p *PanelSettings) ResetSettings() error

func (*PanelSettings) String

func (p *PanelSettings) String() string

String returns config as string

func (*PanelSettings) UpdateSettings

func (p *PanelSettings) UpdateSettings(settings PanelSettings) error

UpdateSettings updates the settings

Directories

Path Synopsis
api

Jump to

Keyboard shortcuts

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