Hardware Script python reference¶
Main interface functions wrapped with lmi commands are:
- get_all_info()
- get_system_info()
- get_motherboard_info()
- get_cpu_info()
- get_memory_info()
- get_disks_info()
All of these accept ns object as the first argument, an instance of lmi.shell.LMINamespace.
Hardware Module API¶
LMI hardware provider client library.
- lmi.scripts.hardware.format_memory_size(size)¶
Returns formatted memory size.
Parameters: size (Number) – Size in bytes Returns: Formatted size string. Return type: String
- lmi.scripts.hardware.get_all_info(ns)¶
Returns: Tabular data of all available info. Return type: List of tuples
- lmi.scripts.hardware.get_all_instances(ns, class_name)¶
Returns all instances of instance_name.
Parameters: instance_name (String) – Instance name Returns: List of instances of instance_name Return type: List of lmi.shell.LMIInstance
- lmi.scripts.hardware.get_colored_string(msg, color)¶
Returns colored message with ANSI escape sequences for terminal.
Parameters: - msg (String) – Message to be colored.
- color (Integer) – Color of the message [GREEN_COLOR, YELLOW_COLOR, RED_COLOR].
Returns: Colored message.
Return type: String
- lmi.scripts.hardware.get_cpu_info(ns)¶
Returns: Tabular data of processor info. Return type: List of tuples
- lmi.scripts.hardware.get_hostname(ns)¶
Returns: Tabular data of system hostname. Return type: List of tuples
- lmi.scripts.hardware.get_memory_info(ns)¶
Returns: Tabular data of memory info. Return type: List of tuples
- lmi.scripts.hardware.get_motherboard_info(ns)¶
Returns: Tabular data of motherboard info. Return type: List of tuples
- lmi.scripts.hardware.get_single_instance(ns, class_name)¶
Returns single instance of instance_name.
Parameters: instance_name (String) – Instance name Returns: Instance of instance_name Return type: lmi.shell.LMIInstance
- lmi.scripts.hardware.get_system_info(ns)¶
Returns: Tabular data of system info, from the LMI_Chassis instance. Return type: List of tuples
- lmi.scripts.hardware.init_result(ns)¶
Returns initialized result list.
Returns: Initialized result list. Return type: List