We are monitoring JSON status page for an app, where multiple checks return Healthy or Unhealthy as it’s status.
I’m looking to somehow being able to tell which check fails exactly if my “Fail” condition will be “Unhealthy”, and then be able to report on history of checks.
I understand that I should be able to do that with post-execution script. Via probably getting html response with response.getResponseBody();, somehow comparing it with my regex, and then returning message that’s interesting for me with api.fail(). I’m missing matching examples to build such post-execution script myself. Anyone bothers enough to help me out?
Previously in SiteScope, I could cover that with regex, where while creating a regex condition, I could set a group with () that would be returned with error message.
Example response body:
{
“First”: {
“status”: “Healthy”,
},
“Second”: {
“status”: “Unhealthy”,
},
“Third”: {
“status”: “Healthy”,
},
}