client

package
v0.0.0-...-25c8ee0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Timeout time.Duration
	URL     url.URL
}

Client for open hardware monitor

func (*Client) Decode

func (c *Client) Decode(r io.Reader) (*Node, error)

Decode json

func (*Client) Fetch

func (c *Client) Fetch() (*Node, error)

Fetch requests

type Hardware

type Hardware struct {
	Type      HardwareType
	Value     string
	TypeIndex int
	TypeCount int
}

Hardware value

type HardwareType

type HardwareType int

HardwareType type https://github.com/openhardwaremonitor/openhardwaremonitor/blob/e199e0ccc69b4da92495266ebc0faf7daad97608/Hardware/IHardware.cs

const (
	// UnknownHardware type
	UnknownHardware HardwareType = iota
	// Mainboard type
	Mainboard
	// SuperIO type
	SuperIO
	// CPU type
	CPU
	// RAM type
	RAM
	// GpuNvidia type
	GpuNvidia
	// GpuAti type
	GpuAti
	// TBalancer type
	TBalancer
	// Heatmaster type
	Heatmaster
	// HDD type
	HDD
	// Controller type for TBalancer or Heatmaster
	Controller
	// Computer type for host
	Computer
)

func (HardwareType) String

func (h HardwareType) String() string

type Node

type Node struct {
	ID       int `json:"id"`
	ImageURL string
	Max      string
	Min      string
	Text     string
	Value    string
	Children []Node
}

Node from data

func Decode

func Decode(r io.Reader) (*Node, error)

Decode json

func (*Node) HardwareType

func (n *Node) HardwareType() HardwareType

HardwareType returns HardwareType of node

func (*Node) IsHardware

func (n *Node) IsHardware() bool

IsHardware returns true if json node is for hardware

func (*Node) IsRoot

func (n *Node) IsRoot() bool

IsRoot returns true if json is a root node

func (*Node) IsSensor

func (n *Node) IsSensor() bool

IsSensor returns true if json node is for a sensor type

func (*Node) IsValue

func (n *Node) IsValue() bool

IsValue true if node has children

func (*Node) SensorType

func (n *Node) SensorType() Sensor

SensorType returns type of sensor

func (*Node) Stringify

func (n *Node) Stringify() string

Stringify tree

func (*Node) Values

func (n *Node) Values() ([]Value, error)

Values from json root

func (*Node) Walk

func (n *Node) Walk(fn Visitor) error

Walk from json root

type Sensor

type Sensor int

Sensor for unit https://github.com/openhardwaremonitor/openhardwaremonitor/blob/e199e0ccc69b4da92495266ebc0faf7daad97608/Hardware/ISensor.cs

const (
	// UnknownSensor in V
	UnknownSensor Sensor = iota
	// Voltage in V
	Voltage
	// Clock in MHz
	Clock
	// Temperature in °C
	Temperature
	// Load in %
	Load
	// Fan in RPM
	Fan
	// Flow in L/h
	Flow
	// Control in %
	Control
	// Level in %
	Level
	// Factor in 1
	Factor
	// Power in W
	Power
	// Data in GB = 2^30 Bytes
	Data
	// SmallData in MB = 2^20 Bytes
	SmallData
)

func (Sensor) String

func (s Sensor) String() string

type Value

type Value struct {
	Hardware []Hardware
	Unit     Sensor
	Label    string
	Value    string
}

Value from ohwm

func (*Value) Float64

func (v *Value) Float64() float64

Float64 gets value as float64

func (*Value) MetricName

func (v *Value) MetricName() (string, map[string]string)

MetricName returns value as a metric name

type Visitor

type Visitor func(v Value) error

Visitor callback function

Jump to

Keyboard shortcuts

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