AutoScale Watch在Softlayer API中带来不正确的数据

时间:2016-09-21 05:01:48

标签: api ibm-cloud-infrastructure

我正在尝试获取触发器数据,但监视数据的值会带来错误的数据。

        "algorithm": "EWMA",
        "id": 135609,
        "metric": "host.network.frontend.in.rate",
        "operator": ">",
        "period": 3600,
        "value": "10485760"

值应为80而不是10485760。我是否需要使用适当的单位转换值?

这是我使用的其他API:

https://api.softlayer.com/rest/v3.1/SoftLayer_Scale_Group/1046365.json?objectMask=mask[id,+name,+status[name,+keyName],+regionalGroup[id,+name,+description],+suspendedFlag,+terminationPolicy,+cooldown,+regionalGroupId,+minimumMemberCount,+maximumMemberCount,+balancedTerminationFlag,+networkVlans[+id,+networkVlan[+id,+name,+vlanNumber,+networkSpace,+primaryRouter[id,hostname,datacenter[name,longName]],localDiskStorageCapabilityFlag,sanStorageCapabilityFlag]],virtualGuestMemberTemplate[hostname,domain,fullyQualifiedDomainName,startCpus,maxMemory,hourlyBillingFlag,localDiskFlag,operatingSystem,datacenter,privateNetworkOnlyFlag,networkComponents.maxSpeed,sshKeys,operatingSystemReferenceCode,blockDevices[device,diskImage.capacity],blockDeviceTemplateGroup.globalIdentifier,postInstallScriptUri],policies[id,cooldown,name,scaleActions[id,type[id,keyName,name],amount,scaleType],triggers[id,type],triggers%28SoftLayer_Scale_Policy_Trigger_OneTime%29[date],triggers%28SoftLayer_Scale_Policy_Trigger_Repeating%29[schedule],triggers%28SoftLayer_Scale_Policy_Trigger_ResourceUse%29[watches[id,algorithm,metric,operator,period,value]]],loadBalancers[id,port,healthCheck[id,attributes[value,type.keyname],type[id,keyname,name]],virtualServer[id,port,virtualIpAddress.ipAddress.ipAddress,virtualIpAddress.id,serviceGroups.routingType.name]],virtualGuestMemberCount]

回应机构:

   "triggers": [{
        "id": 163525,
        "type": {
            "id": 1,
            "keyName": "ONE_TIME",
            "name": "One Time"
        },
        "date": "2016-07-26T14:30:00+09:00"
    }, {
        "id": 163529,
        "type": {
            "id": 3,
            "keyName": "RESOURCE_USE",
            "name": "Resource Use"
        },
        "watches": [{
            "algorithm": "EWMA",
            "id": 135607,
            "metric": "host.cpu.percent",
            "operator": ">",
            "period": 1800,
            "value": "80"
        }, {
            "algorithm": "EWMA",
            "id": 135609,
            "metric": "host.network.frontend.in.rate",
            "operator": ">",
            "period": 3600,
            "value": "10485760"
        }, {
            "algorithm": "EWMA",
            "id": 138903,
            "metric": "host.cpu.percent",
            "operator": ">",
            "period": 7200,
            "value": "78"
        }]

1 个答案:

答案 0 :(得分:0)

对于网络速率的情况,API中的信息以字节存储,而在门户中,信息以兆位显示。

这样做:

converting bytes to bites

10485760 * 8 = 83886080

converting bites to kilo bites

83886080 / 1024 = 81920

converting kilo bites to mega bites

81920 / 1024 = 80

此致