Hello
I'm trying to set up a script watcher but it won't trigger.
Here's my watcher code
{
  "trigger": {
    "schedule": {
      "interval": "5m"
    }
  },
  "input": {
    "http": {
      "request": {
        "scheme": "https",
        "host": "<cluster URL>",
        "port": 9243,
        "method": "get",
        "path": "/_cluster/stats",
        "params": {},
        "headers": {},
        "auth": {
          "basic": {
            "username": "elastic",
            "password": "<password>"
          }
        }
      }
    }
  },
  "condition": {
    "script" : {
      "source" : "return (ctx.payload.nodes.jvm.mem.heap_used_in_bytes /  ctx.payload.nodes.jvm.mem.heap_max_in_bytes) > 0.8"
    }
  },
  "actions": {
    "send_email": {
      "email": {
        "profile": "standard",
        "to": [
          "<email>"
        ],
        "subject": "ZW Recording JVM heap size: {{ctx.payload.nodes.jvm.mem.heap_used_in_bytes}} bytes",
        "body": {
          "text": "JVM heap size is {{ctx.payload.nodes.jvm.mem.heap_used_in_bytes}} bytes\nPayload: {{ctx.payload.nodes.jvm.mem}}",
          "html": "JVM heap size is <b>{{ctx.payload.nodes.jvm.mem.heap_used_in_bytes}}</b> bytes<br/>Payload: {{ctx.payload.nodes.jvm.mem}}"
        }
      }
    }
  }
}
it triggers with a condition of
return (ctx.payload.nodes.jvm.mem.heap_used_in_bytes /  ctx.payload.nodes.jvm.mem.heap_max_in_bytes) > 0
or with
return (ctx.payload.nodes.jvm.mem.heap_used_in_bytes /  ctx.payload.nodes.jvm.mem.heap_max_in_bytes) < 1
but does not trigger when I'm trying to test it like this:
return (ctx.payload.nodes.jvm.mem.heap_used_in_bytes /  ctx.payload.nodes.jvm.mem.heap_max_in_bytes) > 0.1