monit-5.15 re-encodes HTTP check request strings

Issue #314 closed
Dmitry Dzhus created an issue

I'd like to monitor my Elasticsearch node health by running an HTTP check against it using the following request: "/index/_search?source=%7B%22query%22%3A%7B%22filtered%22%3A%7B%22filter%22%3A%7B%22range%22%3A%7B%22modifiedDate%22%3A%7B%22gte%22%3A%22now%22%7D%7D%7D%7D%7D%7D"

I've put it in my checks file:

check host es-mirror with address my.es.host
    if failed ping then alert

    if failed
       port 9200
       protocol http
       request "/index/_search?source=%7B%22query%22%3A%7B%22filtered%22%3A%7B%22filter%22%3A%7B%22range%22%3A%7B%22modifiedDate%22%3A%7B%22gte%22%3A%22now%22%7D%7D%7D%7D%7D%7D"
    then alert

The query succeeds when run from the command line using curl, but in monit UI the request string appears to be re-URL-encoded:

Port Response time failed to [my.es.host]:9200/mirror-article-v1/_search?source=%257B%2522query%2522%253A%257B%2522filtered%2522%253A%257B%2522filter%2522%253A%257B%2522range%2522%253A%257B%2522modifiedDate%2522%253A%257B%2522gte%2522%253A%2522now%2522%257D%257D%257D%257D%257D%257D type TCP/IP protocol HTTP

The check always fails.

I put the request string in the checks file in URL-encoded form becuase when put it as-is ({"query":{"filtered":{"filter":{"range":{"modifiedDate":{"gte":"now-20m"}}}}}) it prevents monit from properly parsing the file due to presence of quotes.

The expected behaviour is monit not re-encoding the request string. I'm observing this bug with monit-5.15 on Ubuntu 14.04.

Comments (3)

  1. Tildeslash repo owner

    We cannot drop the URL encoding for backward compatibility ... if some users rely on it, it would break their configuration.

    You can use apostrophe instead of quotes, the following should work:

    if failed
       port 9200
       protocol http
       request '/index/_search?source={"query":{"filtered":{"filter":{"range":{"modifiedDate":{"gte":"now-20m"}}}}}'
    then alert
    
  2. Dmitry Dzhus reporter

    Thanks for the tip - single quotes work just fine. This bug report is therefore invalid.

  3. Log in to comment