I'm currently trying to create a Watcher that has a 'condition' that will resolve to true when the Watcher execution fails (checks for a "failed" state). I have a Teams webhook that works, and I would like that webhook to be invoked if the Watcher, when run, fails for whatever reason.
Additional context - I should mention that this is an HTTP input-only Watcher that does not utilize any searches. It simply makes an HTTP GET command to an endpoint. The goal is to eventually create a Dashboard that will retrieve the payload data stored in the .watcher-history index.
I'd like Watcher 'condition' logic to resolve to true if, say a GET to the endpoint fails (which results in a 'state' being set to 'failed').
I've noticed that my HTTP Watcher's response has a null value under 'resolved_values' for 'state'. When I do a 'normal' Watcher that utilizes a search, I get a value back for that field. This leads me to believe that an HTTP Watcher that doesn't use a search has no execution context (ctx)?
So my refined question I suppose would be - is there a way to extract out the 'state' from an HTTP input-only Watcher?
Thank you very much for your response. This cleared up some misunderstandings I had on how a Watcher-involved ctx is populated, depending on the context of usage (search input or http input).
To get around my original issue, I simply created another Watcher (to watch the original Watcher). This new Watcher utilizes a search input, which returns the latest execution document from the .watcher-history index, and it digs for the 'status' successfully.
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.