Metricbeat HTTP module - request and process headers only

Hello,
i'm using metricbeat / elasticsearch / kibana.
My goal is to know if the server is UP : i'm planning to do a request (HEAD request will be perfect) then process the headers (and filtering them maybe in logstash?) and check f the received response status is 200 ==> so that means server is UP.

I'm facing some issues with metricbeat configuration file.
The HTTP module is enabled and has this conf :

    - module: http
      metricsets:
        - json
      period: 10s
      hosts: ["localhost:3000"]
      namespace: "json_namespace"
      path: "/"
      method: "HEAD"
      response.enabled: true

using this conf => i got an error.message : unexpected end of JSON input

I think it's because HEAD returns an empty body and parsing an empty body gave this error.

I tried using an other conf :

  - module: http
    metricsets:
      - json
    period: 10s
    hosts: ["localhost:3000"]
    namespace: "json_namespace"
    path: "/"
    body: ""
    method: "GET"
    response.enabled: true

I got this error : invalid character '<' looking for beginning of value

I think it's because < is a starting of an html page ! and that could not be parsed in json!

I'm stuck here ! I ll be glad if you can help me figure it out !
Thank you very much!

I used heartbeat in order to get the status and code of my http requests

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