# \[watcher\] - \[how to\] \[monitor\] Elasticsearch Snapshots

**URL:** <https://discuss.elastic.co/t/watcher-how-to-monitor-elasticsearch-snapshots/76794>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [February 28, 2017, 2:25pm UTC](https://discuss.elastic.co/t/watcher-how-to-monitor-elasticsearch-snapshots/76794 "2017-02-28T14:25:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Orsius](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/orsius/32/13646_2.png) [@Orsius](https://discuss.elastic.co/u/Orsius)\
**Post date:** [February 28, 2017, 2:25pm UTC](https://discuss.elastic.co/t/watcher-how-to-monitor-elasticsearch-snapshots/76794/1 "2017-02-28T14:25:54Z")

</div>

Dear All,

With the help of watcher I would like to be informed when my ES index daily backup failed.

```
# The idea is to have a configuration like: 
PUT _xpack/watcher/watch/my-daily-backup-alert
{
  "trigger": {}, => every morning
  "input": {}, => snapshot is sucessful and its name match the date of the day
  "condition": {}, => nbr of hits > 0
  "transform": {},
  "actions": {} => email admin
}

```

I had a quick look inside the documentation and has chosen to go with "[Calling Elasticsearch APIs](https://www.elastic.co/guide/en/x-pack/current/input-http.html)";

BUT I encountered some difficulties writing the "input" part 😕

Any advice?

Thanks in advance for you help.  
kr,  
O.

```
PUT _xpack/watcher/watch/my-daily-backup-alert
{
  "metadata" : { 
    "color" : "red"
  },
  "trigger" : { 
    "schedule" : {
      "interval" : "55m"
    }
  },
  "input" : {
    "http" : {
      "request" : {
        "host" : "localhost",
        "port" : "9200",
        "path" : "/_snapshot/nfs-repository/_all",
        "params" : {
          "state" : "SUCCESS"
      }
    }
  },
  "condition" : { 
    "compare" : { "ctx.payload.hits.total" : { "gt" : 0 }}
  },
  "transform" : {
  },
  "actions" : { 
    "email_administrator" : {
      "email" : {
        "to" : "sys.admino@host.domain",
        "subject" : "Encountered {{ctx.payload.hits.total}} errors",
        "body" : "WARNING error(s) during backup, see attached data",
        "attachments" : {
          "attached_data" : {
            "data" : {
              "format" : "json"
            }
          }
        },
        "priority" : "high"
      }
    }
  }
}
```

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [February 28, 2017, 6:59pm UTC](https://discuss.elastic.co/t/watcher-how-to-monitor-elasticsearch-snapshots/76794/2 "2017-02-28T18:59:29Z")

</div>

Hey,

can you be more exact, what you concrete issue is except that you encountered difficulties? What did not work as you expected it to work?

--Alex

---

<div class="post-metadata">

**Author:** ![Orsius](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/orsius/32/13646_2.png) [@Orsius](https://discuss.elastic.co/u/Orsius)\
**Post date:** [March 1, 2017, 7:26am UTC](https://discuss.elastic.co/t/watcher-how-to-monitor-elasticsearch-snapshots/76794/3 "2017-03-01T07:26:51Z")

</div>

Hello Alexander, regarding the input part, the syntax I use is not correct ... "port" not recognized 😕

```
  {
    "type": "parse_exception",
    "reason": "could not parse http request template. unexpected string field [port]"
  }
```

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [March 1, 2017, 7:40am UTC](https://discuss.elastic.co/t/watcher-how-to-monitor-elasticsearch-snapshots/76794/4 "2017-03-01T07:40:15Z")

</div>

Hey,

port must be a number, not a string.

--Alex

---

<div class="post-metadata">

**Author:** ![Orsius](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/orsius/32/13646_2.png) [@Orsius](https://discuss.elastic.co/u/Orsius)\
**Post date:** [March 13, 2017, 9:45am UTC](https://discuss.elastic.co/t/watcher-how-to-monitor-elasticsearch-snapshots/76794/5 "2017-03-13T09:45:04Z")

</div>

damned! What a stupid mistake 😕 Thanks anyway  
I hope this 'discussion' may help others.

ps: Of course this topic can be marked as "closed"

---

<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:** [April 10, 2017, 9:45am UTC](https://discuss.elastic.co/t/watcher-how-to-monitor-elasticsearch-snapshots/76794/6 "2017-04-10T09:45:04Z")

</div>

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