Linux技術情報
hprest - RESTfulインターフェースツール
hprest - RESTfulインターフェースツール
本ページに記載してある内容は限られた評価環境に於ける検証結果に基づいたものです。本ページの情報を利用する前に予め技術情報、ディストリビュータが提供する WEBサイト等をご覧ください。
本ソフトウェアの紹介
RESTfulインターフェイスツールは、REST APIを分かりやすい形で利用できるコマンドライン形式の管理ソフトウェアで、REST APIに対応した HPE製品全般の管理が可能です。
ProLiant Gen9では BIOSと iLO4の設定変更が可能です。
モードについて
hprestは実行形態として 3ヶのモードの利用が可能です。
-対話型モード
/usr/bin/hprestをパラメータ無しで起動する事で hprestは対話型モードとなります。本モードでは、個別のオブジェクト配下にあるプロパティの詳細を確認したり、少数の設定変更を行うのに適しています。下記は ProLiantの BootModeの現状と設定可能な VALUEを確認し、変更する例です。
#hprest
hprest : HPE RESTful Interface Tool version 1.5.0
Copyright (c) 2015 Hewlett Packard Enterprise Development Company L.P.
----------------------------------------------------------------------
hprest > login 1.1.1.1 -u ilouser -p ilopasswd
Discovering data from iLO...Done
WARNING: Cache is activated. Session keys are stored in plaintext.
hprest > types
・・・
HpBios.1.2.0
HpSecureBoot.1.0.0
・・・
HpiLOLicense.1.0.0
HpiSCSISoftwareInitiator.1.1.0
PowerMetrics.0.11.0
VirtualMedia.1.0.0
・・・
hprest > select hpbios
hprest > info
・・・
AsrStatus
AsrTimeoutMinutes
BiosVersion
BootMode
DynamicPowerResponse
EmbeddedSata
PowerProfile
PowerRegulator
ProcX2Apic
SecureBootStatus
VirtualInstallDisk
・・・
hprest > get bootmode
BootMode=Uefi
hprest > info bootmode
NAME
BootMode
DISPLAY NAME
Boot Mode
HELP TEXT
Use this option to select the boot mode of the system. Selecting
UEFI Mode configures the system to boot Unified Extensible
・・・
IPv6 PXE Boot, boot > 2.2 TB Disks in AHCI SATA Mode, and Dynamic
Smart Array RAID.
************************************************
WARNING
Boot Mode changes require a system reboot in order to take effect.
Changing the Boot Mode can impact the ability of the server to
・・・
Boot, IPv6 PXE Boot, Boot > 2.2 TB Disks in AHCI SATA Mode, and
Dynamic Smart Array RAID.
**********************************************
TYPE
Enumeration
READ-ONLY
False
POSSIBLE VALUES
Uefi
LegacyBios
hprest > set bootmode=legacybios
Skipping read-only path: /rest/v1/systems/1/bios/Mappings
Skipping read-only path: /rest/v1/registrystore/registries/en/...
hprest > commit
Committing changes...
One or more properties were changed and will not take effect until system is reset.
Logging session out.
hprest > exit
Bye for now
#
対話型モードに入らず、また後述するスクリプト化をするまでもない簡単な設定変更は下記の方法で可能です(/etc/hpresthprest.confにて login情報指定済みの場合)。
#hprest --nologo set bootmode=uefi --selector hpbios --commit
Skipping read-only path: /rest/v1/systems/1/bios/Mappings
Committing changes...
One or more properties were changed and will not take effect until system is reset.
Logging session out.
#
-スクリプタブルモード
/usr/bin/hprestに続いてコマンドをスクリプトに列挙する事で、コマンドをスクリプト化して利用するモードとなります。スクリプトには、サーバーオブジェクトのプロパティの取得や設定に使用できる RESTfulインターフェイスツールコマンドラインをリスト形式で含めて利用します。
前述の対話型モードで現在の BootModeが `Uefi`であり指定可能な他の VALUEとして `LegacyBios`が用意されている事が分かりましたので、2台の ProLiantの BootModeを Legacy(BIOS)モードに一括設定するスクリプト例が下記になります。
#vi test.sh
#!/bin/sh
echo "===== 1st ProLiant ====="
hprest --nologo login 1.1.1.1 -u ilouser -p ilopasswd
hprest --nologo select hpbios
hprest --nologo set bootmode=legacybios
hprest --nologo commit
echo "===== 2nd ProLiant ====="
hprest --nologo login 1.1.1.2 -u ilouser -p ilopasswd
hprest --nologo select hpbios
hprest --nologo set bootmode=legacybios
hprest --nologo commit
#sh ./test.sh
===== 1st ProLiant =====
Discovering data from iLO...Done
WARNING: Cache is activated. Session keys are stored in plaintext.
Skipping read-only path: /rest/v1/systems/1/bios/Mappings
Committing changes...
One or more properties were changed and will not take effect until system is reset.
Logging session out.
===== 2nd ProLiant =====
Discovering data from iLO...Done
WARNING: Cache is activated. Session keys are stored in plaintext.
Skipping read-only path: /rest/v1/systems/1/bios/Mappings
Committing changes...
One or more properties were changed and will not take effect until system is reset.
Logging session out.
#
-ファイルベースモード
ファイルに保存した設定情報を hprestにセーブ・ロードして利用するモードとなります。ファイル形式のデフォルトは JSONで、XMLに変更する事も可能です。下記は `hpbios`をファイルに保存し、そのファイルを修正し BootModeを変更する例となります。
#hprest
hprest : HPE RESTful Interface Tool version 1.5.0
Copyright (c) 2015 Hewlett Packard Enterprise Development Company L.P.
----------------------------------------------------------------------
hprest > login 1.1.1.1 -u ilouser -p ilopasswd
Discovering data from iLO...Done
WARNING: Cache is activated. Session keys are stored in plaintext.
hprest > save --selector hpbios -f hoge.json
hprest > exit
#cat hoge.json | grep -i bootmode
"BootMode": "uefi",
#cat hoge.json | sed -e 's/\"uefi\"/\"legacybios\"/g' > hoge2.json
#diff hoge.json hoge2.json
< "BootMode": "uefi",
---
> "BootMode": "legacybios",
#hprest
hprest : HPE RESTful Interface Tool version 1.5.0
Copyright (c) 2015 Hewlett Packard Enterprise Development Company L.P.
----------------------------------------------------------------------
hprest > login 1.1.1.1 -u ilouser -p ilopasswd
Discovering data from iLO...Done
WARNING: Cache is activated. Session keys are stored in plaintext.
hprest > load -f hoge2.json
Discovering data from iLO...Done
WARNING: Cache is activated. Session keys are stored in plaintext.
Loading configuration...
Property is read-only skipping 'SecureBootStatus'
Property is read-only skipping 'TpmType'
Property is read-only skipping 'TpmState'
Property is unique to the system skipping 'SerialNumber'
Property is unique to the system skipping 'ProductId'
Committing changes...
One or more properties were changed and will not take effect until system is reset.
Logging session out.
Discovering data from iLO...Done
WARNING: Cache is activated. Session keys are stored in plaintext.
Skipping read-only path: /rest/v1/systems/1/bios/Mappings
Committing changes...
Error: No changes found or made during commit operation.
hprest > exit
Open Source & Linux
2015年11月1日付でHewlett-Packard CompanyをHewlett Packard Enterprise Company とHP Inc.に分社する以前に販売された製品については、現在のモデルと異なる、古い製品名およびモデル番号である場合があります。