Heartbeat: http check.response


#1

Hi, I am having an issue using heartbeat, specifically check.response.body

I have the following heartbeat.yml

heartbeat.monitors:
- type: http
# List or urls to query
  urls: ["http://localhost:8090/base/status.json"]
  # request details:
  check.request:
    method: GET
  check.response:
    body: '{"abc":"123"}'
  # Configure task schedule
  schedule: '@every 10s'

It always returns:
"UP": false
"error": "type": "validate"
"error": "message": "body mismatch"

If I replace:
check.response:
body: '{"abc":"123"}'
With
check.response:
status: 200

UP will return as true, my issue only occurs when I use check.response.body

Thanks
Neil


(Steffen Siering) #2

The check.response.body check is quite limited right now. The body must match byte by byte.

Roadmap to Heartbeat GA contains an item about enhanced validators using conditionals and other checks. e.g. regex on body or json response must match subset of configured fields and such.


#3

Hi Steffen,

Thanks for that, is there a way of seeing what heartbeat is returning.
Just thinking in the short term until the feature is fully available, if I was able to see what heartbeat finds in the response body it may help.

Thanks
Neil


(Steffen Siering) #4

no, heartbeat is not returning the response body, to keep the events to be generated somewhat 'small'. The logstash http_poller or metricbeat http module might be alternative solutions I think.


(system) #5

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.