我检查了SoftLayer裸金属服务器的配置
我批量订购了8台裸金属服务器,它们被布置如下。为了确保可用性,裸金属服务器的机架和服务器房间似乎会进行分散布置。由于SoftLayer是开放的,所以可以通过API轻松获取机架的布置位置等信息。
裸金属服务器的布局图
获取裸金属服务器清单的程序
这里是一个用Python编写的程序,可以获取服务器的位置。
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 |
+--------+-------------------+-----------------------------------------------------------+-----------+-----------------+----------------+------------+----------------+-----------------------+