Set up SLA test configurations
Manage your Service-Level Agreement (SLA) test configurations and the resulting availability and performance reports to effectively monitor how well your services are performing.
When working with the SLA API, you need to have READ-WRITE access to it.
Create an SLA test
To use the SLA reports and see their results, first, you need to configure your SLA tests.
-
Before creating a new SLA test configuration, ensure you haven't exhausted the maximum number of allowed availability or performance test configurations on your contract. Run the
Get-SLATestConfigurationQuotacommand to verify that.You can have only one availability test configuration per contract.
Get-SLATestConfigurationQuotacontractId availabilitySlaCounts performanceSlaCounts ---------- --------------------- -------------------- C-0N7RAC7 @{used=0; max=1} @{used=1; max=5} -
For the create operation, you need to specify a region, a so-called agent group. It corresponds to the regional SLA you received with your purchase. To retrieve a list of group agent IDs and their corresponding descriptions, run the
Get-SLATestAgentGroupcommand.Get-SLATestAgentGroupagentGroupId name ------------ ---- 33 APJ SLA 34 ASEAN SLA 18 Europe SLA 35 Australia SLA 19 China SLA 36 India SLA 5 North American SLA 23 Australia SLA 10 Global SLA 13 Global without China SLA 29 NE APAC SLA -
When creating a new availability or performance SLA test configuration, define its required settings in the
-Bodyparameter of theNew-SLATestConfigurationcommand. Use a hashtable,PSCustomObject, or JSON string to pass the request body values.Note that you can't modify the group, contract, and test type after you create the test configuration.
The
performanceSlaTargetrequest body parameter is required only for the performance SLA test types.$myNewSLATest = @{ agentGroupId = 5 contractId = "C-0N7RAC7" groupId = 12345 name = "my-sla-test" performanceSlaTarget = 1.4 testDetails = @{ akamaiUrl = "https://www.example.com/testObject.txt" originDnsHostnameOverride = "mypage.example.com" originUrl = "https://www.example.com/testObject.txt" } type ="PERFORMANCE" } New-SLATestConfiguration -Body $myNewSLATest$myNewSLATest = '{ "agentGroupId": 5, "contractId": "C-0N7RAC7", "groupId": 12345, "name": "my-sla-test", "performanceSlaTarget": 1.4, "testDetails": { "akamaiUrl": "http://www.example.com/testObject.txt", "originDnsHostnameOverride": "mypage.example.com", "originUrl": "http://www.example.com/testObject.txt" }, "type": "PERFORMANCE" }' New-SLATestConfiguration -Body $myNewSLATestslaTestId --------- 12345You can also define your test configuration in a JSON file, load the file into a variable, convert it into a PowerShell object, and pipe it to the command.
$mySLAConfig = Get-Content ./mySLAConfig.json | ConvertFrom-Json -Depth 100 $mySLAConfig | New-SLATestConfiguration
Get an SLA test
If you don't know your SLA test ID, use the Get-SLATestConfiguration to return the list of all SLA tests available to you. For a specific SLA test configuration, pass its ID in the command.
# Get all
Get-SLATestConfiguration
# Get one
Get-SLATestConfiguration -SLATestID '12345'
slaTestId : 12345
contractId : C-0N7RAC7
agentGroupId : 5
name : my-sla-test-1
type : PERFORMANCE
testDetails : @{originUrl=https://www.example.com/testObject.txt;
akamaiUrl=https://www.example.com/testObjec.txt; originDnsHostnameOverride=}
performanceSlaTarget :
availabilityFrequency : 360
slaTestId : 98765
contractId : C-0N7RAC7
agentGroupId : 10
name : my-sla-test-2
type : AVAILABILITY
testDetails : @{originUrl=https://www.example-2.com/testObject.txt; akamaiUrl=https://www.example-2.com/testObject.txt;
originDnsHostnameOverride=}
performanceSlaTarget :
availabilityFrequency : 360
slaTestId : 12345
contractId : C-0N7RAC7
agentGroupId : 5
name : my-sla-test-1
type : PERFORMANCE
testDetails : @{originUrl=https://www.example.com/testObject.txt;
akamaiUrl=https://www.example.com/testObject.txt; originDnsHostnameOverride=mypage.example.com}
performanceSlaTarget : 1.4
availabilityFrequency : 360
Update an SLA test
To update a specific SLA test, first, get a specific record, save its output locally, and edit it according to your needs.
Get-SLATestConfiguration -SLATestID '12345' | ConvertTo-Json -Depth 100 | Out-File -FilePath ./mySLAConfig.json
{
"slaTestId": 12345,
"contractId": "C-0N7RAC7",
"agentGroupId": 18,
"name": "my-updated-sla-test",
"type": "PERFORMANCE",
"testDetails": {
"originUrl": "http://www.other-example.com/testObject.txt",
"akamaiUrl": "http://www.other-example.com/testObject.txt",
"originDnsHostnameOverride": "myotherpage.example.com"
},
"performanceSlaTarget": 1.96,
"availabilityFrequency": 360,
"akamaiInternalInfo": {
"originSaTestId": 98765,
"akamaiSaTestId": 43219
}
}
Then convert it back to a PowerShell object and pipe it to the Set-SLATestConfiguration command.
$mySLAConfig = Get-Content ./mySLAConfig.json | ConvertFrom-Json -Depth 100
$mySLAConfig | Set-SLATestConfiguration -SLATestID '12345'
Alternatively, you can save the result of the Get-SLATestConfiguration command in a variable and update specific attributes of your SLA test, then pipe the whole object back to the Set-SLATestConfiguration command to make your changes effective.
$mySLAConfig = Get-SLATestConfiguration -SLATestID 12345
$mySLAConfig.name = 'my-updated-sla-test'
$mySLAConfig.agentGroupId = 10
$mySLAConfig.testDetails.originUrl = "http://www.other-example.com/testObject.txt"
$mySLAConfig | Set-SLATestConfiguration -SLATestID '12345'
The Set-SLATestConfiguration command doesn't return anything. To verify your changes, run the Get-SLATestConfiguration command and pass the ID of the updated SLA.
Delete an SLA test
To delete an existing SLA test configuration, use the Remove-SLATestConfiguration command. Provide the ID of the SLA test configuration you want to delete.
Remove-SLATestConfiguration -SLATestID '12345'
Updated 4 months ago
