You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
go-ipmi is a pure golang native IPMI library. It DOES NOT wraps ipmitool.
Usage
import (
"fmt""github.com/bougou/go-ipmi"
)
funcmain() {
host:="10.0.0.1"port:=623username:="root"password:="123456"client, err:=ipmi.NewClient(host, port, username, password)
// Support local mode client if runs directly on linux// client, err := ipmi.NewOpenClient()iferr!=nil {
panic(err)
}
// you can optionally open debug switch// client.WithDebug(true)// Connect will create an authenticated session for you.iferr:=client.Connect(); err!=nil {
panic(err)
}
// Now you can execute other IPMI commands that need authentication.res, err:=client.GetDeviceID()
iferr!=nil {
panic(err)
}
fmt.Println(res.Format())
selEntries, err:=client.GetSELEntries(0)
iferr!=nil {
panic(err)
}
fmt.Println(ipmi.FormatSELs(selEntries, nil))
}
Functions Comparision with ipmitool
Each command defined in the IPMI specification is a pair of request/response messages.
These IPMI commands are implemented as methods of the ipmi.Client struct in this library.
Some ipmitool cmdline usages are implemented by calling just one IPMI command,
but others are not. Like ipmitool sdr list, it's a loop of GetSDR IPMI command.
So this library also implements some methods that are not IPMI commands defined
in IPMI sepcification, but just some common helpers, like GetSDRs to get all SDRs.
These methods are marked with an asterisk (*) after the method name in the following docs.
The implementation logic of IPMI commands is almost same. See Contributing