I am trying to get trigger data, but the value of watch data bring wrong data.
"algorithm": "EWMA",
"id": 135609,
"metric": "host.network.frontend.in.rate",
"operator": ">",
"period": 3600,
"value": "10485760"
The value should be 80
instead of 10485760
. Do I need to convert the value with a proper unit ?
This is rest API I've used:
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]
Response Body :
"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"
}]
For the case of network rate the information in the API is being stored in bytes, and in the portal the information is being displayed in mega bits.
So do this:
converting bytes to bites
10485760 * 8 = 83886080
converting bites to kilo bites
83886080 / 1024 = 81920
converting kilo bites to mega bites
81920 / 1024 = 80
Regards