Skip to content

bmctools.ipmi.ipmitool

IpmiTool

Simple Ipmitool wrapper. Requires ipmitool to be installed and available as a shell command. ipmi_command() can use used to run arbitrary ipmi commands and additional functions are added for common operations. NOTE: Currently, these will not run directly on stackstorm k8s, must be run through toolbox action.

Sample Usage: mynode = IpmiTool(10.206.137.50, admin, mypassword) sel_list = mynode.get_sel_list()

With server object:

mynode = Server(mapi, uuid) mynode.ipmitool.power_status()

Parameters:

NameTypeDefaultDescription
hoststr
userstr
passwordstr

ipmitool_command

def ipmitool_command(command: str) -> str

Execute arbitary ipmitool command.

Parameters:

NameTypeDefaultDescription
commandstr

Returns: str

power_status

def power_status() -> str

Get the current power status of the system.

Returns: String output from ipmitool (e.g., ‘Chassis Power is on’).

Returns: str

power_off

def power_off() -> str

Issue a hard power-off command.

Returns: String output from ipmitool.

Returns: str

power_on

def power_on() -> str

Issue a power-on command.

Returns: String output from ipmitool.

Returns: str

power_reset

def power_reset() -> str

Issue a hard power-reset command.

Returns: String output from ipmitool.

Returns: str

bmc_reset_warm

def bmc_reset_warm() -> str

Perform a warm reset of the BMC controller.

Returns: String output from ipmitool.

Returns: str

bmc_reset_cold

def bmc_reset_cold() -> str

Perform a cold reset of the BMC controller.

Returns: String output from ipmitool.

Returns: str

sel_list

def sel_list(elist: Optional[bool] = False, raw: Optional[bool] = False, age: Optional[bool] = None) -> Union[list, bool]

Retrieve the System Event Log (SEL).

Args: elist: If True, use extended list format (sel elist) for richer event details. raw: If True, return the raw string output instead of a parsed list. age: Filter events newer than this age string (e.g., ‘30d’, ‘12h’, ‘2h’). Cannot be combined with raw.

Returns: Parsed list of event dicts, raw string (if raw=True), or False if the log is empty.

Raises: ValueError: If both raw and age are specified.

Parameters:

NameTypeDefaultDescription
elistOptional[bool]False
rawOptional[bool]False
ageOptional[bool]None

Returns: Union[list, bool]

sol_deactivate

def sol_deactivate() -> str

Deactivate an active Serial Over LAN (SOL) session.

Returns: String output from ipmitool.

Returns: str

sol_looptest

def sol_looptest(num_loops: Optional[int] = 1) -> str

Run a Serial Over LAN loopback test.

Args: num_loops: Number of loopback iterations to run (default: 1).

Returns: String output from ipmitool.

Raises: TypeError: If num_loops is not an integer.

Parameters:

NameTypeDefaultDescription
num_loopsOptional[int]1

Returns: str