My application has a ping url that returns a HTTP status of 200 if the application is working correctly. I'd like to add a watcher action usinghttp input that monitors this url and alerts me via email if anything other than 200 is returned. Is this possible with http input?
I tried to check if the ctx.payload is empty when the application is down but it looks like when the http url is unavailable, any condition defined on the watch is not executed? I set a repsonse and read timeout value of 5s. Also is there a way to look at the HTTP response code through the Watcher execution context? I wasn't able to find a way listed in the documentation.
I'm using X-Pack 5.0.0 alpha4 release
Thanks,
Vinayak
Sorry for the late reply. I tried a couple of different watch conditions with different painless scripts including the one below. Even if I just had a painless script of "return true", the email action wasn't executed when the server I was trying to ping was shut down. The "return true" worked when the server I was pinging was online:
indeed you cant check for the HTTP response code right now, but I think that is a good feature to add. We could just add it to the payload as well, as we did with the headers in 5.0.
Do you have any header that only occurs if the request is valid, which you could use as a workaround?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.