# CCR Stats - Using Watcher

**URL:** <https://discuss.elastic.co/t/ccr-stats-using-watcher/243099>\
**Category:** Kibana\
**Tags:** elastic-stack-monitoring, elastic-stack-alerting, ccr-cross-cluster-replication\
**Created:** [July 29, 2020, 5:14pm UTC](https://discuss.elastic.co/t/ccr-stats-using-watcher/243099 "2020-07-29T17:14:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maries](https://avatars.discourse-cdn.com/v4/letter/m/ec9cab/32.png) [@Maries](https://discuss.elastic.co/u/Maries)\
**Post date:** [July 29, 2020, 5:14pm UTC](https://discuss.elastic.co/t/ccr-stats-using-watcher/243099/1 "2020-07-29T17:14:06Z")

</div>

We have CCR enabled in Elasticsearc and there are few indices getting replicated. Is there a way to setup monitoring alert using watcher script by querying \_ccr/stats and trigger an alert if data is not getting replicated ?

---

<div class="post-metadata">

**Author:** ![Igor\_Zaytsev](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_zaytsev/32/50662_2.png) [@Igor\_Zaytsev](https://discuss.elastic.co/u/Igor_Zaytsev)\
**Post date:** [July 31, 2020, 8:13pm UTC](https://discuss.elastic.co/t/ccr-stats-using-watcher/243099/2 "2020-07-31T20:13:46Z")

</div>

I think this is possible, but we don't have this kind of watcher (in particular) out of the box. Should be pretty straight forward to implement by querying `_ccr/stats` and matching replicas. Here is a helpful guide to get started: [https://www.elastic.co/guide/en/elasticsearch/reference/current/how-watcher-works.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/how-watcher-works.html)

---

<div class="post-metadata">

**Author:** ![Maries](https://avatars.discourse-cdn.com/v4/letter/m/ec9cab/32.png) [@Maries](https://discuss.elastic.co/u/Maries)\
**Post date:** [August 2, 2020, 3:29pm UTC](https://discuss.elastic.co/t/ccr-stats-using-watcher/243099/3 "2020-08-02T15:29:19Z")

</div>

I'm trying to write a query to extract "time\_since\_last\_read\_millis" from \_ccr/stats using GET.  
Is there a way to extract only fields from \_ccr/stats instead of getting field from `hostname:port/_ccr/stats`

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 30, 2020, 3:29pm UTC](https://discuss.elastic.co/t/ccr-stats-using-watcher/243099/4 "2020-08-30T15:29:22Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
