Forum Discussion

CHATEL_Eric_195's avatar
CHATEL_Eric_195
Icon for Nimbostratus rankNimbostratus
Sep 08, 2015

Monitor ElasticSearch node

Hi,

I try to create a new monitor which be able to check availability of each node by searching

"status" : 200

This, is an output of curl -v 10.10.10.20:9200

* About to connect() to 10.10.10.20 port 9200 (0)
*   Trying 10.10.10.20... connected
* Connected to 10.10.10.20 (10.10.10.20) port 9200 (0)
> GET / HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8y zlib/1.2.3 libidn/0.6.5
> Host: 10.10.10.20:9200
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: application/json; charset=UTF-8
< Content-Length: 334
<
{
  "status" : 200,
  "name" : "Bounty",
  "cluster_name" : "elas-prod",
  "version" : {
    "number" : "1.6.2",
    "build_hash" : "622039121e53e5f520b5ff8720fdbd3d0cb5326b",
    "build_timestamp" : "2015-07-29T09:24:47Z",
    "build_snapshot" : false,
    "lucene_version" : "4.10.4"
  },
  "tagline" : "You Know, for Search"
}
* Connection 0 to host 10.10.10.20 left intact
* Closing connection 0

So, with this Send String, monitor doesn't work

GET / HTTP/1.1\r\nUser-Agent:\r\nHost:\r\nAccept: */*\r\nConnection: close\r\n

What i've missed please ?

Thanks a lot, Best regards

Jérôme

3 Replies

  • Hi Jerome!

    You can test your monitor with

    echo -ne "GET / HTTP/1.1\r\nUser-Agent:\r\nHost:\r\nAccept: */*\r\nConnection: close\r\n" | nc [IP] [Port]
    

    In your case I'd add an extra \r\n in the end:

    GET / HTTP/1.1\r\nUser-Agent:\r\nHost:\r\nAccept: */*\r\nConnection: close\r\n\r\n
    

    That should do the trick!

    /Patrik

  • Great ! It's now working, you're the best thanks a lot.

     

    At first test with only one \r\n , no data was return but with another \r\n i've got status page like with curl.

     

    • boneyard's avatar
      boneyard
      Icon for MVP rankMVP
      the second \r\n is indeed required according to the HTTP specification, the empty line signals the end of the request.