Watcher not finding proper condition variable

Hi, I've been trying to set a watcher/watchers where it monitors the health of certain indices. If the health of those indices goes red, it'll send out an email.

I've been trying to get the watcher to actually run - by just sending an email if the index is green - but it seems to not be reading the correct variable. It'll send the email when I set the condition to either not equal red or green, so the email aspect doesn't seem to be the problem. The status of the node doesn't seem to email either.

PUT _xpack/watcher/watch/cluster_health_watch
{
  "trigger" : {
    "schedule" : { "interval" : "10s" }
  },
  "input" : {
    "http" : {
      "request" : {
       "host" : "<host>",
       "port" : <port>,
       "path" : "/_cluster/health/1g?level=indices"
      }
    }
  },
  "condition" : {
    "compare" : {
      "ctx.payload.indices.1g.status" : { "eq" : "green" }
    }
  },
  "actions" : {
    "send_email" : {
      "email" : {
        "from" : "<email>",
        "to" : "<email>",
        "subject" : "Watcher Notification",
        "body" : "{{ctx.payload.indeces.1g.status}} - test"
      }
    }
  }
}

Is there anything that I'm doing incorrectly with this watcher, or anything that can be configured? I'm using Kibana 5.0 and elastic 5.0 in this cluster.

the variable in the email actio nis called indeces, not indices.

That said, the output of the Execute watch API would help here.

Also, there is a longish blog post about debugging watches that might help you a lot to test these kidn of problems in the future.

Thank you for responding - I did fix the spelling error and look through all the documentation, and have not have any success. It still doesn't read the status of the index. Whenever I do execute watch API, the following comes up, and I'm unsure of why it's not reading the proper variable.

      "condition": {
    "type": "compare",
    "status": "success",
    "met": false,
    "compare": {
      "resolved_values": {
        "ctx.payload.indices.1g.status": null

please see my previous post about the output from the execute watch API that would help here tremendously debugging the issue. Please create a gist and link it. Thank you!

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