ベアメタル・サーバーを一括で8台オーダーしたところ以下のように配置されました。ベアメタル・サーバーも可用性確保のためラックやサーバー・ルームは分散配置されるようです。SoftLayerはオープンなのでラックの配置場所などもAPIから簡単に取得できます。
ベアメタル・サーバーの配置図
ベアメタル・サーバーの一覧を取得するプログラム
サーバーのロケーションを取得するPythonプログラムはこちらです。
getHwLocation.py
import SoftLayer
from prettytable import PrettyTable
client = SoftLayer.Client()
_mask = '''
id,
fullyQualifiedDomainName,
operatingSystem,
billingItem.orderItem.order.userRecord.username,
primaryIpAddress,
primaryBackendIpAddress,
datacenter,
serverRoom,
location.pathString '''
table = PrettyTable(['id',
'FQDN',
'Operating System',
'Owner',
'Primary IP',
'Backend IP',
'DataCenter',
'Server Room',
'location detail'])
virtualGuests = client['Account'].getHardware(mask=_mask)
for vg in virtualGuests:
table.add_row([vg['id'],
vg['fullyQualifiedDomainName'],
vg['operatingSystem']['softwareLicense']['softwareDescription']['longDescription'],
vg['billingItem']['orderItem']['order']['userRecord']['username'],
vg.get('primaryIpAddress') or "--",
vg['primaryBackendIpAddress'],
vg['datacenter']['longName'],
vg['serverRoom']['longName'],
vg['location']['pathString']])
print table
実行方法
pythonプログラムはSLクライアントのインストールされた端末から以下を実行します。サーバー・ルーム、ラック名、スイッチ、ルーターの情報などが出力されます。
$ python getHwLocation.py
実行結果
+--------+-------------------+-----------------------------------------------------------+-----------+-----------------+----------------+------------+----------------+-----------------------+
| id | FQDN | Operating System | Owner | Primary IP | Backend IP | DataCenter | Server Room | location detail |
+--------+-------------------+-----------------------------------------------------------+-----------+-----------------+----------------+------------+----------------+-----------------------+
| xxxxxx | node01.hpc.com | CentOS / CentOS / 6.5-64 | IBMxxxxxx | 161.xxx.xxx.244 | 10.xxx.xxx.71 | Tokyo 2 | Server Room 01 | tok02.sr01.rk96.sl13 |
| xxxxxx | node02.hpc.com | CentOS / CentOS / 6.5-64 | IBMxxxxxx | 161.xxx.xxx.247 | 10.xxx.xxx.90 | Tokyo 2 | Server Room 02 | tok02.sr02.rk216.sl15 |
| xxxxxx | node03.hpc.com | CentOS / CentOS / 6.5-64 | IBMxxxxxx | 161.xxx.xxx.242 | 10.xxx.xxx.113 | Tokyo 2 | Server Room 02 | tok02.sr02.rk209.sl39 |
| xxxxxx | node04.hpc.com | CentOS / CentOS / 6.5-64 | IBMxxxxxx | 161.xxx.xxx.246 | 10.xxx.xxx.88 | Tokyo 2 | Server Room 02 | tok02.sr02.rk209.sl35 |
| xxxxxx | node05.hpc.com | CentOS / CentOS / 6.5-64 | IBMxxxxxx | 161.xxx.xxx.243 | 10.xxx.xxx.69 | Tokyo 2 | Server Room 02 | tok02.sr02.rk206.sl21 |
| xxxxxx | node06.hpc.com | CentOS / CentOS / 6.5-64 | IBMxxxxxx | 161.xxx.xxx.222 | 10.xxx.xxx.112 | Tokyo 2 | Server Room 02 | tok02.sr02.rk206.sl09 |
| xxxxxx | node07.hpc.com | CentOS / CentOS / 6.5-64 | IBMxxxxxx | 161.xxx.xxx.221 | 10.xxx.xxx.110 | Tokyo 2 | Server Room 02 | tok02.sr02.rk203.sl21 |
| xxxxxx | node08.hpc.com | CentOS / CentOS / 6.5-64 | IBMxxxxxx | 161.xxx.xxx.245 | 10.xxx.xxx.73 | Tokyo 2 | Server Room 01 | tok02.sr01.rk96.sl15 |
+--------+-------------------+-----------------------------------------------------------+-----------+-----------------+----------------+------------+----------------+-----------------------+