For example, you can tell Elasticsearch to send an email when the cluster health changes, CPU usage is higher for a specific period of time when a specific file is accessed, and many more. To say that watchers are a revolutionary feature would be an understatement.
However, due to the scope of this tutorial, we will not explore how watchers work or how to use them.
This tutorial aims to show you how to use the Elasticsearch watcher API to gather information about an existing watcher.
You can explore the docs to learn more about Elasticsearch watchers.”
Elasticsearch Get Watcher API
The GET watcher API allows us to fetch watch information by its ID. The request syntax is as shown below:
The request requires manage_watcher or monitor_watcher privileges for usa.e
Example
Suppose we have a watcher that uses metricbeat to monitor when a docker container is created and sends an email if true.
We can use the request below to retrieve information about the watcher as shown:
The following example shows how to use the get watche r
This should return detailed information about the watcher as shown:
In this case, we can see the watcher details, including the defined conditions and the actions taken.
Conclusion
This simple tutorial covers using the get watcher API to gather information about an existing watcher in an Elasticsearch cluster.
Thanks for reading & Happy cluster admin!!