ipmi

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package ipmi implements in-band communication with BMC using IPMI commands using `/dev/ipmi*` device.

Index

Constants

View Source
const (
	IPMICTL_SET_GETS_EVENTS_CMD     = 0x80046910 //nolint:stylecheck
	IPMICTL_SEND_COMMAND            = 0x8028690d //nolint:stylecheck
	IPMICTL_RECEIVE_MSG_TRUNC       = 0xc030690b //nolint:stylecheck
	IPMI_SYSTEM_INTERFACE_ADDR_TYPE = 0xC        //nolint:stylecheck
	IPMI_BMC_CHANNEL                = 0xF        //nolint:stylecheck
)

IPMI related constants.

View Source
const (
	IPMI_DCMI           = 0xDC //nolint:stylecheck
	IPMI_DCMI_GETRED    = 0x2  //nolint:stylecheck
	IPMI_NETFN_DCGRP    = 0x2C //nolint:stylecheck
	IPMI_DCMI_ACTIVATED = 0x40 //nolint:stylecheck
)

IPMI DCMI related constants.

View Source
const (
	IPMI_LAN             = 0x1 //nolint:stylecheck
	IPMI_LANP_IP_ADDR    = 0x2 //nolint:stylecheck
	IPMI_NETFN_TRANSPORT = 0xC //nolint:stylecheck
)

IPMI DCMI related constants.

View Source
const (
	// NFDBitS is the amount of bits per mask.
	NFDBits = 8 * 8
)

Variables

This section is empty.

Functions

func FDClr

func FDClr(fd uintptr, p *unix.FdSet)

FDClr clear a fd of fdSet.

func FDIsSet

func FDIsSet(fd uintptr, p *unix.FdSet) bool

FDIsSet return true if fd is set.

func FDSet

func FDSet(fd uintptr, p *unix.FdSet)

FDSet set a fd of fdSet.

func FDZero

func FDZero(p *unix.FdSet)

FDZero set to zero the fdSet.

Types

type IPMIClient

type IPMIClient struct {
	Logger  *slog.Logger
	DevFile *os.File
	BMCAddr ipmiSystemInterfaceAddr
}

func NewIPMIClient

func NewIPMIClient(devNum int, logger *slog.Logger) (*IPMIClient, error)

NewIPMIClient returns a new instance of IPMIClient struct.

func (*IPMIClient) Close

func (i *IPMIClient) Close() error

Close IPMI device file.

func (*IPMIClient) Do

func (i *IPMIClient) Do(req *ipmiReq, t time.Duration) (*ipmiResp, error)

Do sends IPMI request and returns the response.

func (*IPMIClient) LanIP

func (i *IPMIClient) LanIP(timeout time.Duration) (*string, error)

LanIP returns the IP address of BMC.

func (*IPMIClient) PowerReading

func (i *IPMIClient) PowerReading(timeout time.Duration) (*PowerReading, error)

PowerReading returns the current IPMI DCMI power reading.

type Msg

type Msg struct {
	Netfn     uint8
	Lun       uint8
	Cmd       uint8
	TargetCmd uint8
	DataLen   uint16
	Data      uintptr
}

type PowerReading

type PowerReading struct {
	Minimum, Maximum, Average, Current uint16
	Activated                          bool
}

Jump to

Keyboard shortcuts

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