# Metricbeat HTTP module - custom request and fetch headers only

**URL:** <https://discuss.elastic.co/t/metricbeat-http-module-custom-request-and-fetch-headers-only/233912>\
**Category:** Beats\
**Tags:** beats-module, metricbeat\
**Created:** [May 22, 2020, 2:01pm UTC](https://discuss.elastic.co/t/metricbeat-http-module-custom-request-and-fetch-headers-only/233912 "2020-05-22T14:01:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![adilld](https://avatars.discourse-cdn.com/v4/letter/a/cc9497/32.png) [@adilld](https://discuss.elastic.co/u/adilld)\
**Post date:** [May 22, 2020, 2:01pm UTC](https://discuss.elastic.co/t/metricbeat-http-module-custom-request-and-fetch-headers-only/233912/1 "2020-05-22T14:01:42Z")

</div>

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 :

```auto
    - 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 :

```auto
  - 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!

---

<div class="post-metadata">

**Author:** ![Andre\_Letterer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andre_letterer/32/42248_2.png) [@Andre\_Letterer](https://discuss.elastic.co/u/Andre_Letterer)\
**Post date:** [May 29, 2020, 12:34am UTC](https://discuss.elastic.co/t/metricbeat-http-module-custom-request-and-fetch-headers-only/233912/2 "2020-05-29T00:34:01Z")

</div>

I think in order to understand if you can use `json_namespace` could you please post an anonymized output of http page: [http://localhost:3000](http://localhost:3000)  
-\> or is it  
[https://localhost:3000](https://localhost:3000)  
?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 26, 2020, 12:34am UTC](https://discuss.elastic.co/t/metricbeat-http-module-custom-request-and-fetch-headers-only/233912/3 "2020-06-26T00:34:18Z")

</div>

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