我正在使用softlayer api在仪表板上实现监控。 为了检查当前的服务器状态,我使用了下面的API并计算它们。
Baremetal server : hw.asService(client).getServerPowerState();
Virtual server : guest.getPowerState().getKeyName();
状态的结果是“开”或“关”。 (运行或暂停VM)
我如何知道恢复的次数?
答案 0 :(得分:0)
我不确定你是什么意思"恢复",我没有重新见过在softlayer中看到过这样的状态。
我认为您的意思是当事务正在运行时(例如,当服务器或VSI被修改或重新加载时),您可以使用以下方法获取该信息:
http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/getActiveTransaction http://sldn.softlayer.com/reference/services/SoftLayer_Hardware_Server/getActiveTransaction
当没有事务正在运行时,方法返回空。
此致
答案 1 :(得分:0)
请尝试以下请求:
https://[username]:[apikey]@api.softlayer.com/rest/v3.1/SoftLayer_Account/getObject?objectMask=mask[networkMonitorUpHardware,networkMonitorUpVirtualGuests, networkMonitorRecoveringHardware, networkMonitorRecoveringHardware(SoftLayer_Hardware_Server)[ activeTransactions[ transactionGroup ] ], networkMonitorDownHardware[ hardwareStatus, datacenter[ longName ] ], networkMonitorDownHardware(SoftLayer_Hardware_Server)[ activeTransactions[transactionGroup ] ], networkMonitorRecoveringVirtualGuests, networkMonitorDownVirtualGuests ]
Method: GET
<强>参考:强> SoftLayer_Account - datatypes
掩码中涉及的属性:
- networkMonitorDownHardware
- networkMonitorDownVirtualGuests
- networkMonitorRecoveringHardware
- networkMonitorRecoveringVirtualGuests
- networkMonitorUpHardware
- networkMonitorUpVirtualGuests