source

package
v0.7.10 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ACPI

type ACPI struct {
	CollectEnergy bool
	// contains filtered or unexported fields
}

Advanced Configuration and Power Interface (APCI) makes the system hardware sensor status information available to the operating system via hwmon in sysfs.

func NewACPIPowerMeter

func NewACPIPowerMeter(mockpath string) *ACPI

func (*ACPI) GetAbsEnergyFromPlatform

func (a *ACPI) GetAbsEnergyFromPlatform() (map[string]float64, error)

GetEnergyFromHost returns the accumulated energy consumption

func (*ACPI) GetCPUCoreFrequency

func (a *ACPI) GetCPUCoreFrequency() map[int32]uint64

func (ACPI) GetName

func (ACPI) GetName() string

func (*ACPI) IsHWMONCollectionSupported

func (a *ACPI) IsHWMONCollectionSupported() bool

func (*ACPI) IsSystemCollectionSupported

func (a *ACPI) IsSystemCollectionSupported() bool

func (*ACPI) StopPower

func (a *ACPI) StopPower()

type Actions

type Actions struct {
	PowerPowerSupplyReset PowerPowerSupplyReset `json:"#Power.PowerSupplyReset,omitempty"`
}

type InputRanges

type InputRanges struct {
	InputType      string `json:"InputType,omitempty"`
	MinimumVoltage int    `json:"MinimumVoltage,omitempty"`
	MaximumVoltage int    `json:"MaximumVoltage,omitempty"`
	OutputWattage  int    `json:"OutputWattage,omitempty"`
}

type PowerControl

type PowerControl struct {
	OdataID             string        `json:"@odata.id,omitempty"`
	MemberID            string        `json:"MemberId,omitempty"`
	Name                string        `json:"Name,omitempty"`
	PowerConsumedWatts  int           `json:"PowerConsumedWatts,omitempty"`
	PowerRequestedWatts int           `json:"PowerRequestedWatts,omitempty"`
	PowerAvailableWatts int           `json:"PowerAvailableWatts,omitempty"`
	PowerCapacityWatts  int           `json:"PowerCapacityWatts,omitempty"`
	PowerAllocatedWatts int           `json:"PowerAllocatedWatts,omitempty"`
	PowerMetrics        PowerMetrics  `json:"PowerMetrics,omitempty"`
	PowerLimit          PowerLimit    `json:"PowerLimit,omitempty"`
	RelatedItem         []RelatedItem `json:"RelatedItem,omitempty"`
	Status              Status        `json:"Status,omitempty"`
}

type PowerHMC

type PowerHMC struct{}

func (*PowerHMC) GetAbsEnergyFromPlatform

func (a *PowerHMC) GetAbsEnergyFromPlatform() (map[string]float64, error)

GetEnergyFromHost returns the accumulated energy consumption

func (*PowerHMC) GetName

func (a *PowerHMC) GetName() string

func (*PowerHMC) IsSystemCollectionSupported

func (a *PowerHMC) IsSystemCollectionSupported() bool

func (*PowerHMC) StopPower

func (a *PowerHMC) StopPower()

type PowerLimit

type PowerLimit struct {
	LimitInWatts   int    `json:"LimitInWatts,omitempty"`
	LimitException string `json:"LimitException,omitempty"`
	CorrectionInMs int    `json:"CorrectionInMs,omitempty"`
}

type PowerMetrics

type PowerMetrics struct {
	IntervalInMin        int `json:"IntervalInMin,omitempty"`
	MinConsumedWatts     int `json:"MinConsumedWatts,omitempty"`
	MaxConsumedWatts     int `json:"MaxConsumedWatts,omitempty"`
	AverageConsumedWatts int `json:"AverageConsumedWatts,omitempty"`
}

type PowerPowerSupplyReset

type PowerPowerSupplyReset struct {
	Target string `json:"target,omitempty"`
}

type PowerSupplies

type PowerSupplies struct {
	OdataID              string        `json:"@odata.id,omitempty"`
	MemberID             string        `json:"MemberId,omitempty"`
	Name                 string        `json:"Name,omitempty"`
	Status               Status        `json:"Status,omitempty"`
	PowerSupplyType      string        `json:"PowerSupplyType,omitempty"`
	LineInputVoltageType string        `json:"LineInputVoltageType,omitempty"`
	LineInputVoltage     int           `json:"LineInputVoltage,omitempty"`
	PowerCapacityWatts   int           `json:"PowerCapacityWatts,omitempty"`
	LastPowerOutputWatts int           `json:"LastPowerOutputWatts,omitempty"`
	Model                string        `json:"Model,omitempty"`
	Manufacturer         string        `json:"Manufacturer,omitempty"`
	FirmwareVersion      string        `json:"FirmwareVersion,omitempty"`
	SerialNumber         string        `json:"SerialNumber,omitempty"`
	PartNumber           string        `json:"PartNumber,omitempty"`
	SparePartNumber      string        `json:"SparePartNumber,omitempty"`
	InputRanges          []InputRanges `json:"InputRanges,omitempty"`
	RelatedItem          []RelatedItem `json:"RelatedItem,omitempty"`
}

type RedFishClient

type RedFishClient struct {
	// contains filtered or unexported fields
}

func NewRedfishClient

func NewRedfishClient() *RedFishClient

func (*RedFishClient) GetAbsEnergyFromPlatform

func (rf *RedFishClient) GetAbsEnergyFromPlatform() (map[string]float64, error)

GetAbsEnergyFromPlatform returns the power consumption in Watt

func (*RedFishClient) GetName

func (*RedFishClient) GetName() string

func (*RedFishClient) IsSystemCollectionSupported

func (rf *RedFishClient) IsSystemCollectionSupported() bool

func (*RedFishClient) StopPower

func (rf *RedFishClient) StopPower()

StopPower stops the power collection timer

type RedfishAccessInfo

type RedfishAccessInfo struct {
	Username string `json:"username"`
	Password string `json:"password"`
	Host     string `json:"host"`
}

RedfishAccessInfo is the struct for the access model

type RedfishPowerModel

type RedfishPowerModel struct {
	OdataType     string          `json:"@odata.type,omitempty"`
	ID            string          `json:"Id,omitempty"`
	Name          string          `json:"Name,omitempty"`
	PowerControl  []PowerControl  `json:"PowerControl,omitempty"`
	Voltages      []Voltages      `json:"Voltages,omitempty"`
	PowerSupplies []PowerSupplies `json:"PowerSupplies,omitempty"`
	Actions       Actions         `json:"Actions,omitempty"`
	OdataID       string          `json:"@odata.id,omitempty"`
}

RedfishPowerModel is the struct for the power model this is generated via the following command: redfishtool raw GET /redfish/v1/Chassis/System.Embedded.1/Power#/PowerControl, where "System.Embedded.1" is the system ID from the RedfishSystemModel the output is then formatted via https://mholt.github.io/json-to-go/ based on sample output from https://www.dmtf.org/sites/default/files/standards/documents/DSP2046_2023.1.pdf

type RedfishSystemModel

type RedfishSystemModel struct {
	OdataContext string `json:"@odata.context"`
	OdataID      string `json:"@odata.id"`
	OdataType    string `json:"@odata.type"`
	Description  string `json:"Description"`
	Members      []struct {
		OdataID string `json:"@odata.id"`
	} `json:"Members"`
	MembersOdataCount int    `json:"Members@odata.count"`
	Name              string `json:"Name"`
}

RedfishSystemModel is the struct for the system model this is generated via the following command: redfishtool Systems

type RedfishSystemPowerResult

type RedfishSystemPowerResult struct {
	// contains filtered or unexported fields
}

RedfishSystemPowerResult is the system power query result

type RelatedItem

type RelatedItem struct {
	OdataID string `json:"@odata.id,omitempty"`
}

type Status

type Status struct {
	State  string `json:"State,omitempty"`
	Health string `json:"Health,omitempty"`
}

type Voltages

type Voltages struct {
	OdataID                   string        `json:"@odata.id,omitempty"`
	MemberID                  string        `json:"MemberId,omitempty"`
	Name                      string        `json:"Name,omitempty"`
	SensorNumber              int           `json:"SensorNumber,omitempty"`
	Status                    Status        `json:"Status,omitempty"`
	ReadingVolts              int           `json:"ReadingVolts,omitempty"`
	UpperThresholdNonCritical float64       `json:"UpperThresholdNonCritical,omitempty"`
	UpperThresholdCritical    int           `json:"UpperThresholdCritical,omitempty"`
	UpperThresholdFatal       int           `json:"UpperThresholdFatal,omitempty"`
	LowerThresholdNonCritical float64       `json:"LowerThresholdNonCritical,omitempty"`
	LowerThresholdCritical    int           `json:"LowerThresholdCritical,omitempty"`
	LowerThresholdFatal       int           `json:"LowerThresholdFatal,omitempty"`
	MinReadingRange           int           `json:"MinReadingRange,omitempty"`
	MaxReadingRange           int           `json:"MaxReadingRange,omitempty"`
	PhysicalContext           string        `json:"PhysicalContext,omitempty"`
	RelatedItem               []RelatedItem `json:"RelatedItem,omitempty"`
}

Jump to

Keyboard shortcuts

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