cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Chart and alert based on JSON response value

iromaniuk
Newcomer

I setup http monitor for load balancer but I am interested in collecting values from response i.e. jsonData.SlbStatEnhVServerTable[0].CurrSessions see my script below Then eventually being able to create chart or alerting.. . Please advicce



{

"version": "1.0",

"requests": [

{

"description": "mml-app-api",

"url": "https://{vADC}/config/SlbStatEnhVServerTable/mml-app-api",

"method": "GET",

"authentication": {

"type": "BASIC_AUTHENTICATION",

"credentials": "CREDENTIALS_VAULT-71A23FD2F6B0C5B3"

},

"validation": {

"rules": [

{

"value": ">=400",

"passIfFound": false,

"type": "httpStatusesList"

}

],

"rulesChaining": "or"

},

"configuration": {

"acceptAnyCertificate": true,

"followRedirects": true

},

"preProcessingScript": "api.setValue(\"vADC\", \"10.1.1.11\");",

"postProcessingScript": "if (response.getStatusCode() != 200) {\r\n api.fail(\"HTTP error: \" + response.getStatusCode());\r\n}\r\nvar responseBody = response.getResponseBody();\r\nvar jsonData = JSON.parse(responseBody);\r\napi.setValue(\"CurrSessions\", jsonData.SlbStatEnhVServerTable[0].CurrSessions);\r\napi.info(jsonData.SlbStatEnhVServerTable[0].CurrSessions);"

}

]

}

2 REPLIES 2

ChadTurner
DynaMight Guru
DynaMight Guru

For this you might want to make a custom event for alerting as this will notify you as an alert. Id imagine you can also create this to show up via multidimensional analysis chart or even with USQL since this is also synthetics.

-Chad

Appreciate , instead I added second request to http monitor which takes "CurrSessions" value from previous request and POSTs it back to DT, see my question here. I am getting Bad request response code 400