티스토리 뷰

Linux

IPMI 활용

덕쑤 2016. 5. 9. 11:22


출처 : http://coffeenix.net/board_print.php?bd_code=1765



 커피닉스, 시스템 엔지니어의 쉼터

  IPMI 셋팅과 이용작성일 : 2014/12/23 18:29
 
  • 글쓴이 : 좋은진호 (  http://coffeenix.net/ )
  • 조회수 : 6838
     
    제  목 : IPMI 셋팅과 이용
    작성자 : 좋은진호(truefeel, http://coffeenix.net/ )
    작성일 : 2014.11.25(화)

    IPMI(Intelligent Platform Management Interface)는 서버를 포함한 컴퓨터를 관리하고 모니터링 할 수 있는 기능을 제공하는 표준 플랫폼이다. 제조사에 상관없이 H/W가 IPMI를 지원하면 동일한 방식으로 괸리와 모니터링을 할 수 있다. (제조사별로 추가된 일부 명령이 있음) IPMI를 이용하면 서버 CPU, FAN, 파워, 메모리, 온도 등 각종 센서 정보를 모니터링할 수 있고, H/W 이벤트 발생(메모리 문제, Power 문제)시 syslog를 통해 바로 확인할 수 있다. 그리고 IPMI 네트웍환경을 통해 원격에서 서버를 켜고 끌 수 있을 뿐 아니라 콘솔화면을 그대로 볼 수 있다.
    H/W 장애시 빠른 대응과 관리 편의성을 제공하는 IPMI는 서버 관리에 필수 사항이다.


    1. IPMI 준비

    오래된 서버들도 IPMI를 지원하지만, 실제 지원하는지 확인하고 싶다면 dmidecode로 알 수 있다. IPMI정보가 나오면 지원하는 것이다. 단 버전이 2.0보다 낮다면(예를들어 1.5라던지) 이용하는데 제약이 생길 수 있다.

     
    dmidecode | grep -A10 IPMI
     


    1) Linux에서 (CentOS)

    IPMI 패키지를 설치한다. freeipmi, ipmitool 등 여러 툴이 있지만 ipmitool을 사용하겠다.

     
    yum install ipmitool OpenIPMI
    ipmitool lan print 1 <-- IPMI 커널 모듈을 로딩하지 않아서 그렇다.
    Could not open device at /dev/ipmi0 or /dev/ipmi/0 or /dev/ipmidev/0: No such file or directory
     


    IPMI 커널 모듈을 로딩한다.

     
    service ipmi start
    lsmod |grep ipmi
    ipmi_devintf            7729  2 
    acpi_ipmi               3745  1 power_meter
    ipmi_si                44687  2 acpi_ipmi
    ipmi_msghandler        38826  3 ipmi_devintf,acpi_ipmi,ipmi_si
     


    2) FreeBSD에서

    ipmitool 패키지를 설치하고 커널 모듈을 로딩한다.

     
    pkg install ipmitool
    kldload ipmi
    kldstat | grep ipmi
    3    1 0xffffffff80fdc000 f970     ipmi.ko
     


    부팅시에 IPMI모듈이 자동으로 올라오도록 /boot/loader.conf 에 다음을 추가한다. 단, FreeBSD 8.1에서는 버그(?)로 인해 부팅시 kernel panic이 일어날 수 있으니, 부팅 이후 따로 로딩하도록.

     
    ipmi_load="YES"
    coretemp_load="YES"
     



    2. IPMI 이용 예

    1) 시스템 이벤트 로그(System Event Log, SEL) 확인

     
    ipmitool sel list
       1 | 06/20/2012 | 21:32:52 | Event Logging Disabled #0x72 | Log area reset/cleared | Asserted
       2 | 07/18/2012 | 14:19:01 | Power Supply #0x63 | Power Supply AC lost | Asserted
       3 | 07/18/2012 | 14:19:11 | Power Supply #0x74 | Redundancy Lost | Asserted
    ... 생략 ...
     


    2) FRU(Field Replaceable Unit) 정보 확인. 서버 모델명, 장비 제조사, 파워 서플라이 정보, 메모리 정보 등을 확인할 수 있다. 서버 업체에 따라 표시되는 항목들이 다르다.

     
    ipmitool fru
    ... 생략 ...
    FRU Device Description : iDRAC7          
    Board Mfg Date        : Wed May  2 17:27:00 2012
    Board Mfg             : DELL
    Board Product         : PowerEdge R620                
    ... 생략 ...

    FRU Device Description : PS1 (ID 1)
    Board Mfg Date        : Mon Jun  4 18:14:00 2012
    Board Mfg             : DELL
    Board Product         : PWR SPLY,750WP,RDNT,DELTA     
    ... 생략 ...

    FRU Device Description : PS2 (ID 2)
    Board Mfg Date        : Mon Jun  4 18:44:00 2012
    Board Mfg             : DELL
    Board Product         : PWR SPLY,750WP,RDNT,DELTA     
    ... 생략 ...
     


    3) 각종 센서 정보 확인

     
    ipmitool sensor
    ... 생략 ...
    FAN MOD 1A RPM   | 4320.000   | RPM        | ok    | na        | 1920.000  | na        | na        | na        | na        
    FAN MOD 2A RPM   | 4440.000   | RPM        | ok    | na        | 1920.000  | na        | na        | na        | na        
    FAN MOD 3A RPM   | 4320.000   | RPM        | ok    | na        | 1920.000  | na        | na        | na        | na        
    ... 생략 ...
     


    4) SDR(Sensor Data Repository) 정보 확인

    SDR(Sensor Data Repository) 정보 중에 FAN 정보만 보려면 type fan 옵션을 추가한다. 이 외에 온도 정보(type temp), Voltage 정보(type voltage), 배터리 정보(type batt)만 등 다양한 센서정보만 별도로 확인할 수 있다.

     
    ipmitool sdr
    ... 생략 ...
    Current 1        | 0.40 Amps         | ok
    Current 2        | 0.20 Amps         | ok
    Voltage 1        | 216 Volts         | ok
    Voltage 2        | 216 Volts         | ok
    PS Redundancy    | 0x00              | ok
    ... 생략 ...
    ipmitool sdr type
    ipmitool sdr type fan
    Fan1A RPM        | 30h | ok  |  7.1 | 2400 RPM
    Fan2A RPM        | 32h | ok  |  7.1 | 2280 RPM
    Fan3A RPM        | 34h | ok  |  7.1 | 2400 RPM
    Fan4A RPM        | 36h | ok  |  7.1 | 2160 RPM
    Fan5A RPM        | 38h | ok  |  7.1 | 2280 RPM
    Fan6A RPM        | 3Ah | ok  |  7.1 | 2280 RPM
    Fan Redundancy   | 75h | ok  |  7.1 | Fully Redundant
    ... 생략 ...
     


    5) Power 상태 확인. power 명령은 원격지에서 서버 전원을 켜거나 끄거나, 리부팅할 때 주로 사용한다.

     
    # ipmitool power status
    Chassis Power is on
     


    6) Boot Device 변경

    부팅시 PXE 부팅, CDROM 부팅되도록 설정할 수 있다. 또는 자동으로 BIOS 셋업화면으로 들어갈 수도 있다.
    하지만 IPMI SOL(Serial Over LAN)을 이용하면 콘솔화면을 원격에서 볼 수 있으니, 이 명령을 이용하지 않고도 원격에서 BIOS화면을 보면서 부팅 디바이스를 변경할 수 있다. 따라서 이 명령은 IPMI SOL을 이용할 수 없는 상황에서 유용하다. (※ SOL에 대해서는 별도 글에서 설명하겠다.)

     
    ipmitool chassis bootdev
    bootdev [clear-cmos=yes|no]
    bootdev [options=help,...]
      none  : Do not change boot device order
      pxe   : Force PXE boot
      disk  : Force boot from default Hard-drive
      safe  : Force boot from default Hard-drive, request Safe Mode
      diag  : Force boot from Diagnostic Partition
      cdrom : Force boot from CD/DVD
      bios  : Force boot into BIOS Setup
      floppy: Force boot from Floppy/primary removable media
    #
    ipmitool chassis bootdev cdrom     <-- CD/DVD 부팅되도록 한다.
    Set Boot Device to cdrom
    ipmitool chassis bootparam get 5
    Boot parameter version: 1
    Boot parameter 5 is valid/unlocked
    Boot parameter data: 8014000000
    Boot Flags :
       - Boot Flag Valid                                     <-- Invalid -> Valid로 바뀜
       - Options apply to only next boot                     <-- 이번 Boot Device설정은 일회성
       - BIOS PC Compatible (legacy) boot 
       - Boot Device Selector : Force Boot from CD/DVD       <-- No override -> Force Boot ...로 바뀜
       - Console Redirection control : System Default
       - BIOS verbosity : Console redirection occurs per BIOS configuration setting (default)
       - BIOS Mux Control Override : BIOS uses recommended setting of the mux at the end of POST
    #
    ipmitool chassis bootdev bios      <-- 부팅할 때 BIOS 셋업화면으로 들어간다.
    Set Boot Device to bios
    ipmitool chassis bootparam set bootflag force_bios <-- 또는 chassis bootparam 설정으로도 동일한 
    Set Boot Device to force_bios
     


    부팅 디바이스 변경은 일회성이여서 한 번 부팅 후에는 원래 설정으로 돌아간다. 만약 매번 바뀐 설정이 유지되도록 하려면 persistent 옵션을 추가하면 된다. Dell 1950서버는 persistent 옵션이 유지되었지만, R610서버에서는 부팅 후 이전 상태로 돌아가버렸다. 개인적 경험이니 R610설정을 제가 잘 못 한 것일 수도. ^^

     
    ipmitool chassis bootdev none  options=help        <-- 다양한 옵션 확인
    ipmitool chassis bootdev cdrom options=persistent  <-- 부팅할 때마다 계속 CDROM BIOS화면으로 들어가도록 한다.
    ipmitool chassis bootparam get 5
    ... 생략 ...
    Boot Flags :
       - Boot Flag Valid
       - Options apply to all future boots                   <-- 변경 유지
    ... 생략 ...
     


    7) 이외에 개인적으로 자주 사용하는 명령들

    ipmitool mc info        : Management Controller 정보를 확인할 수 있다. IPMI firmware정보, 제조사, ..
    ipmitool channel info 1 : Management Controller 채널 정보를 확인한다. IPMI LAN 설정시 access on/off 상태(Access Mode) 확인할 때 편리하다.
    ipmitool sol info 1     : SOL(Serial-over-LAN), 즉 원격지에서 콘솔화면을 보기위한 설정 정보를 확인한다. 인증 허용 여부, Serial BPS 등
    ipmitool delloem mac    : Dell 서버만 해당되는 OEM 명령으로 LAN Interface별 MAC주소와 IPMI MAC주소를 확인할 수 있다.
    ipmitool delloem powermonitor : Dell 서버만 해당되는 명령이며, 전력 사용량 정보를 확인한다. 

     
    ipmitool delloem mac

    System LOMs
    NIC Number   MAC Address      Status

    0      ??:??:fd:??:??:ba   Enabled
    1      ??:??:fd:??:??:bb   Enabled
    2      ??:??:fd:??:??:b8   Enabled
    3      ??:??:fd:??:??:b9   Enabled

    iDRAC7 MAC Address ??:??:fd:??:??:54
    ipmitool delloem powermonitor
    Power Tracking Statistics
    Statistic      : Cumulative Energy Consumption
    Start Time     : Thu Mar 31 16:05:44 2011
    Finish Time    : Mon Nov 24 18:21:01 2014
    Reading        : 1142.4 kWh
    ... 생략 ...
     


    ipmitool에서 지원하지 않는 OEM별 명령을 freeipmi의 ipmi-oem명령에서 지원할 수 있으니, 필요시 함께 사용하는 것도 좋을 것 같다.

     
    ipmi-oem dell get-power-consumption-data <-- ipmitool delloem powermonitor와 동일한 명령
    Cumulative Energy Start Time : 03/31/11 - 16:05:44
    Cumulative Energy            : 1142.39 kWh
    ... 생략 ...
     



    3. 원격 관리를 위한 IPMI IP 셋팅

    IPMI용 IP를 셋팅하지 않으면 로컬에서만 IPMI 결과를 볼 수 있다. 로컬에서만 사용하는 건 IPMI의 능력(?)을 반의 반만 사용하는 것이다.
    IPMI IP를 셋팅하면 원격에서 서버를 켜거나 리부팅할 수 있고, 콘솔화면을 원격에서 그대로 볼 수 있다. 그리고 FAN RPM, 파워 서플라이 정보, 전력사용량, 각종 센서 정보를 원격에서도 그대로 뽑아올 수 있다.

    IPMI IP셋팅을 위해서는 별도 네트웍망을 구축해야 하는가? 아니다. 네트웍망을 변경없이 그대로 사용하고, IPMI IP만 서버에 추가해주면 된다.
    단 서버의 IP와는 다른 IP를 사용해야하며, 네트웍 스위치에는 IPMI용 게이트웨이 IP를 추가 셋팅해줘야 한다.

    IPMI IP 셋팅 명령은 다음과 같다.

     
    # ipmitool lan set 1 ipsrc static
    # ipmitool lan set 1 ipaddr 
    # ipmitool lan set 1 netmask 
    # ipmitool lan set 1 defgw ipaddr 
    # ipmitool lan set 1 access on
     


    다음과 같은 환경으로 셋팅한다고 하자.

     
    - 서버 IP : 10.10.1.120  (ifconfig결과에 나오는 IP. IPMI와 무관함)
    - IPMI IP : 10.10.20.120
    - IPMI GW : 10.10.20.1   (네트웍 스위치에 이 IP가 있어야 다른 IPMI서버끼리 통신을 할 수 있다.)
     


     
    ipmitool lan print 1
    Set in Progress         : Set Complete
    Auth Type Support       : NONE MD2 MD5 PASSWORD 
    Auth Type Enable        : Callback : MD2 MD5 
                            : User     : MD2 MD5 
                            : Operator : MD2 MD5 
                            : Admin    : MD2 MD5 
                            : OEM      : 
    IP Address Source       : Static Address       <-- static
    IP Address              : 192.168.0.120        <-- 셋팅 전
    Subnet Mask             : 255.255.255.0
    MAC Address             : ??:??:c4:ee:??:??
    SNMP Community String   : public
    IP Header               : TTL=0x40 Flags=0x40 Precedence=0x00 TOS=0x10
    BMC ARP Control         : ARP Responses Enabled, Gratuitous ARP Disabled
    Default Gateway IP      : 192.168.0.1
    Default Gateway MAC     : 00:00:00:00:00:00
    ... 생략 ...
    ipmitool lan set 1 ipsrc static    <-- DHCP로 되어 있으면 아래 명령 자체가 먹지 않는다. 보통 static으로 이미 되어 있음.
    ipmitool lan set 1 ipaddr 10.10.20.120
    Setting LAN IP Address to 10.10.20.120
    ipmitool lan set 1 netmask 255.255.255.0
    Setting LAN Subnet Mask to 255.255.255.0
    ipmitool lan set 1 defgw ipaddr 10.10.20.1
    Setting LAN Default Gateway IP to 10.10.20.1
    ipmitool lan set 1 access on
    #
    ipmitool lan print 1
    Set in Progress         : Set Complete
    Auth Type Support       : NONE MD2 MD5 PASSWORD 
    Auth Type Enable        : Callback : MD2 MD5 
                            : User     : MD2 MD5 
                            : Operator : MD2 MD5 
                            : Admin    : MD2 MD5 
                            : OEM      : 
    IP Address Source       : Static Address
    IP Address              : 10.10.20.120          <-- 셋팅 후
    Subnet Mask             : 255.255.255.0
    MAC Address             : ??:??:c4:ee:??:??
    SNMP Community String   : public
    IP Header               : TTL=0x40 Flags=0x40 Precedence=0x00 TOS=0x10
    BMC ARP Control         : ARP Responses Enabled, Gratuitous ARP Disabled
    Default Gateway IP      : 10.10.20.1            <-- 셋팅 후
    Default Gateway MAC     : 00:00:00:00:00:00
    ... 생략 ...
     


    IPMI를 2대 이상 셋팅하고, 셋팅된 다른 서버에서 ping 10.10.20.120을 해본다. ping이 되어야 정상.
    ping이 안된다면 'IPMI over LAN(IPMI 네트웍 접속) 트러블슈팅'을 읽어보길 바란다.


    4. IPMI user 셋팅

    원격지에서 인증할 user를 설정한다.

     
    ipmitool user list 1
    ID  Name        Callin  Link Auth   IPMI Msg   Channel Priv Limit
    2   root             true    true       true       ADMINISTRATOR
    ipmitool user set password 2 <-- 숫자 2는 위의 ID필드에 표시된 유저 ID를 말함. 위에서는 'root' ID.
    Password for user 2:  <-- PW 입력
    Password for user 2:  <-- PW 재입력
    ipmitool user summary 1
    Maximum IDs       : 16
    Enabled User Count  : 1   <-- enable 유저가 1명 있음.
    Fixed Name Count    : 1
     


    만약 Enabled User가 0으로 나온다면 ipmitool user enable 2 명령으로 enable시킨다. 비밀번호는 interactive하게 입력하지 않고, ipmitool user set password 2 <비밀번호> 처럼 셋팅할 수 있다. 스크립트로 셋팅하면 이 방법이 유용

     
    ipmitool -I lan -H 10.10.20.20 -U root power status
    Password: 
    Chassis Power is on
    ipmitool -I lan -H 10.10.20.20 -U root -P <비밀번호> power status
    Chassis Power is on
     



    5. IPMI event 데몬

    ipmievd 데몬은 SEL(System Event Log, ipmitool sel info로 확인 가능)을 10초간격으로 체크해서 syslog로 보내주는 데몬이다. 데몬은 syslog의 LOCAL4 facility값으로 보내준다. CPU, FAN, 메모리 H/W 문제, RAID 배터리 문제, 파워 Redundancy 메시지, Disk 교체 메시지 등 각종 H/W 메시지를 SEL 결과값으로 확인할 수 있다.

    1) Linux에서 (CentOS)

    /etc/sysconfig/ipmievd 셋팅한다. (120초 간격으로 체크하도록 설정)
     
    IPMIEVD_OPTIONS="sel timeout=120 pidfile=/var/run/ipmievd.pid"
     


    service ipmievd start

    2) FreeBSD에서

    ipmievd용 rc 스크립트는 제공되지 않으므로 다음과 같이 /usr/local/etc/rc.d/ipmievent 스크립트를 만들고, rc.conf 에 ipmievent_enable="YES" 를 추가한다.

    service ipmievent start

    [ ipmievent rc 스크립트 : ipmievent ]
     
    #!/bin/sh
    #
    # ipmievd daemon
    #
    # PROVIDE: ipmievent
    # REQUIRE: LOGIN
    # BEFORE:  securelevel
    # KEYWORD: shutdown
    #
    # Add the following lines to /etc/rc.conf to enable 'ipmievd':
    # ipmievent_enable="YES"
    #
    # by truefeel (좋은진호, http://coffeenix.net/)

    . /etc/rc.subr

    ipmievent_enable=${ipmievent_enable:-"NO"}

    name="ipmievent"
    rcvar="ipmievent_enable"      # `set_rcvar`
    command="/usr/local/sbin/ipmievd"

    [ -z "${ipmievent_flags}" ] && ipmievent_flags="timeout=120"
    ipmievent_flags=" sel ${ipmievent_flags}"
    required_files="/dev/ipmi0"
    pidfile="/var/run/ipmievd.pid0"

    load_rc_config $name
    run_rc_command "$1"
     


    3) IPMI event 로그를 수집하는 syslog서버가 별도로 있다면, 각 서버에는 다음과 같이

    - syslog의 경우 (/etc/syslog.conf)
     
    # IPMI
    local4.debug            @10.10.1.123
     


    - rsyslog의 경우 (/etc/rsyslog.d/ipmi.conf )
     
    # IPMI
    local4.debug            @10.10.1.123:514
     



    6. 서버 LCD 바꾸기 (Dell 서버의 경우)

    Dell서버는 LCD화면에 표시될 정보(또는 메시지)를 바꿀 수 있다. 디폴트로 서버 시리얼넘버(Service Tag)가 표시된다. coffeenix.net으로 변경한 예이다.



     
    ipmitool delloem lcd
    ... 생략 ...
       lcd set mode {none}|{modelname}|{ipv4address}|{macaddress}|
       {systemname}|{servicetag}|{ipv6address}|{ambienttemp}
       {systemwatt }|{assettag}|{userdefined}
    ... 생략 ...
    ipmitool delloem lcd set mode userdefined coffeenix.net
    LCD info
        Setting: User defined
        Text:    coffeenix.net

    ipmitool delloem lcd set mode servicetag
    LCD info
        Setting:   System Tag


    공지사항
    최근에 올라온 글
    최근에 달린 댓글
    Total
    Today
    Yesterday
    링크
    TAG
    more
    «   2024/05   »
    1 2 3 4
    5 6 7 8 9 10 11
    12 13 14 15 16 17 18
    19 20 21 22 23 24 25
    26 27 28 29 30 31
    글 보관함