Use IPMI to control/monitor Linux servers, ipmilinux
1 IPMI Overview
IPMI provides many rich functions. The functions I use are as follows:
1. Obtain the hardware information of the device, including the temperature, voltage, and fan speed of the CPU and motherboard.
2. on device A, use commands to control remote device B, start, shut down, and restart the device. (Is there any impulse to do something bad? haha)
For details about IPMI, basic principles, and necessary conditions, refer to [1.
Using ipmitool to implement ipmi management http://www.ibm.com/developerworks/cn/linux/l-ipmi/ for servers in Linux
1.1 prerequisites:
Because IPMI functions are relatively independent from OS and hardware, only the following three features can be used in any software or hardware environment.
BMC chip + ipmi module loading + ipmitool
1.2 determine whether the required conditions of IPMI are met:
Cat/var/log/messages | grep BMC. Check whether the found BMC chip is printed at startup. If not, the hardware environment does not support the BMC chip;
Lsmod | grep ipmi, check whether the module is loaded, load/lib/modules/2. *. * The corresponding modules in the/kernel/drivers/char/ipmi directory. If this directory is not available, install the IPMI kernel module;
Ipmitool help to check whether the user-mode tool is installed.
1.3 two usage methods:
Local call: the local environment must meet the preceding three requirements.
Remote Call: Call the system. Only the ipmitool module is required. The called system must have the BMC chip and ipmi module. For remote calls, the BMC chip of the called system only needs to write the required configuration information. Even if the system replaces the software system of the Wuwei IPMI module, the configuration information will not be erased or changed in the BMC chip, the local machine can still be remotely called.
2 IPMI usage 2.1 ipmitool instructions:
Ipmitool help; ipmitool Commands para help
Http://linux.die.net/man/1/ipmitool
2.2 obtain local hardware information:
Ipmitool sdr
Of course, the ipmi local call also provides a lot of functions. I only use this one, hey.
2.3 Remote Call Common commands (Remote switch): 2.3.1 two notes for remote control of BMC Chip
Physical network port: ipmi depends on the physical network port to receive ipmi commands. In the hardware manual, it generally describes which physical network port is the BMC chip shared or exclusive. Generally, a physical network port is shared with the eth0 port. Of course, the main board may be designed as the BMC chip to exclusively occupy a network port. Therefore, the network connection of the eth0 port (or exclusive network port) must be guaranteed, the ip address of ipmi is in the same CIDR block as the ip address of eth0 (or an exclusive network port.
Channel: although the BMC chip provides many channels, it seems that only one channel can be used for a model chip, generally channel 1. If channel 1 cannot be used, try other channels, which channel should be used for this chip? I understand it as required in the hardware specification.
2.3.2 configure the BMC chip of the IPMI called/monitoring end:
The controlled end needs to configure lan and user information
Ipmitool lan set 1 ipsrc static # configure the IP Address Source for manual Configuration
Ipmitool lan set 1 ipaddr 192.168.0.1 # configure the IP address (the IP address must be in the same CIDR block as the IP address of the shared network port)
Ipmitool lan set 1 netmask 255.255.255.0 # configure the subnet mask
Ipmitool lan set 1 defgw ipaddr 192.168.0.100 # configure the Default Gateway (no gateway is available)
Ipmitool lan set 1 access on # Open this channel (multiple executions do not affect Management)
Ipmitool lan set 1 access off # disable this channel
Ipmitool lan set 1 user # the user who activates the channel (1 is the channel number)
Ipmitool user list 1 # view users in channel 1
Ipmitool user set name 1 admin # set the user name. 1 is the user ID.
Ipmitool user set password 1 111111 # set password. 1 is the user ID.
Ipmitool user enabled 1 # activate a user
Ipmitool user priv 1 4 1 # Set user as administrator and 1 as user ID.
2.3.3 call/monitor remote command execution:
Ipmitool-I lan-H 192.168.0.100-U admin-P 111111 power status # view power status
Ipmitool-I lan-H 192.168.0.100-U admin-P 111111 power off/down # Shutdown
Ipmitool-I lan-H 192.168.0.100-U admin-P 111111 power on/up # boot
Ipmitool-I lan-H 192.168.0.100-U admin-P 111111 power reset # restart