获取特定资产的趋势数据
检索指定时间范围内、指定时间间隔内的读数数据集。使用这些数据来建立趋势,从而规划、管理和优化您的工作负载。
先决条件
- 身份验证 - 请提交您的用户凭据、客户端 ID 和客户端密钥以进行 OAuth2 身份验证。有关如何调用 OAuth API 来验证和确认您的凭据的说明,请参阅API 身份验证。
步骤2:获取资产清单
使用 Get Assets API 请求检索您有权访问的资产。
示例 curl 请求 - 从 CH1 IBX 数据中心检索电气资产
curl -X
GET "https://api.equinix.com/asset/v1/list?accountNo=1&ibx=CH1&classification=Electrical"
-H "authorization: Bearer <token>'
示例响应
{
"payLoad": {
"classification": "Electrical",
"categories": [
{
"templates": [
{
"assets": [
{
"assetId": "CH1.Gen-1",
"ibx": "CH1",
"alarmStatus": "OK",
"resiliencyStatus": "Resiliency as Designed",
"alarmLastTriggeredTime": "Sep 16,2016 04:41 PM",
"alarmLastClearedTime": "Sep 16,2016 04:43 PM"
},
{
"assetId": "CH1.Gen-2",
"ibx": "CH1",
"alarmStatus": "OK",
"resiliencyStatus": "Resiliency as Designed",
"alarmLastTriggeredTime": "Sep 20,2016 04:48 PM",
"alarmLastClearedTime": "Sep 20,2016 04:53 PM"
},
{
"assetId": "CH1.Gen-3",
"ibx": "CH1",
"alarmStatus": "OK",
"resiliencyStatus": "Resiliency as Designed",
"alarmLastTriggeredTime": "Oct 04,2016 07:54 AM",
"alarmLastClearedTime": "Oct 04,2016 08:41 AM"
}
],
"templateId": "Generator"
}
],
"categoryName": "Global"
}
]
},
"status": {
"type": "INFO",
"statuscode": "1000",
"msg": "OK"
}
}
步骤3:获取资产详情
使用 获取资产详细信息 API 请求检索资产详细信息,包括标签点标识符。
示例 curl 请求 - 检索 CH1.Gen-1 详细信息
curl -X
GET "https://api.equinix.com/asset/v1/details?accountNo=1&ibx=CH1&assetId=CH1.Gen-1&classification=Electrical"
-H "authorization: Bearer <token>'
示例响应
{
"payLoad": {
"assetId": "CH1.Gen-1",
"assetType": "Generator",
"userPrefTimeZone": "America/Los_Angeles",
"tags": [
{
"value": "78.5",
"tagId": "CH1.Gen-1:fuelhours",
"tagDisplayName": "Fuel Hours",
"uom": "h",
"alarmStatus": "OK",
"readingTime": "20190324023353"
},
{
"value": "0",
"tagId": "CH1.Gen-1:runningemergencyservice",
"tagDisplayName": "Running Emergency Service",
"uom": "",
"alarmStatus": "OK",
"readingTime": "20190324023421"
},
{
"value": "0.0",
"tagId": "CH1.Gen-1:voltage",
"tagDisplayName": "Voltage",
"uom": "V",
"alarmStatus": "OK",
"readingTime": "20190324022309"
},
{
"value": "NORMAL",
"tagId": "CH1.Gen-1:alarm",
"tagDisplayName": "Alarm",
"uom": "",
"alarmStatus": "OK",
"readingTime": "20190324022351"
},
{
"value": "0",
"tagId": "CH1.Gen-1:runningnonemergencyservice",
"tagDisplayName": "Running NonEmergency Service",
"uom": "",
"alarmStatus": "OK",
"readingTime": "20190324023421"
},
{
"value": "READY TO START, AUTO",
"tagId": "CH1.Gen-1:summary",
"tagDisplayName": "Summary",
"uom": "",
"alarmStatus": "OK",
"readingTime": "20190324023421"
}
],
"lastMaintenanceDate": "Mar 17,2019",
"manufacturerName": "CATERPILLAR",
"equipmentModelNumber": "SR-4B",
"equipmentSerialNumber": "5JW00638",
"alarmLastTriggeredTime": null,
"alarmLastProcessedTime": null
},
"status": {
"type": "INFO",
"statuscode": "1000",
"msg": "OK"
}
}
步骤 4:获取趋势数据
使用 获取资产标签点趋势 API 请求检索给定标签点的指定读数集。
curl 请求示例
curl -X
GET "https://api.equinix.com/asset/v1/tagpoint/trending?accountNo=1&ibx=CH1&tagId=CH1.Gen-5:fuelhours&interval=1h&fromDate=1483244949000&toDate=1493958549001"
-H "authorization: Bearer <token>"
示例响应
{
"payLoad": {
"accountNumber": "1",
"ibx": "CH1",
"interval": "1h",
"uom": "h",
"tagId": "CH1.Gen-5:fuelhours",
"tagDisplayName": "Fuel Hours",
"dataType": "Float",
"data": [
{
"datetime": "1484355108000",
"value": "81.21"
},
{
"datetime": "1484365910000",
"value": "80.35"
},
{
"datetime": "1484373126000",
"value": "81.23"
},
{
"datetime": "1484383929000",
"value": "82.15"
},
{
"datetime": "1484405555000",
"value": "81.33"
}
]
},
"status": {
"type": "INFO",
"statuscode": "1000",
"msg": "OK"
}
}