How to create alert in watcher advance? for the basic metrics of CPU, MEMORY

How do I add more fields in the message of my alert by watcher

If you configure an advanced watch by editing the JSON directly, you should be able to update the action to attach any fields you want from the watch execution context.

For example, if you have fields in your document source and you want to include, say, the fields from your first hit, you can do something like this in the "Actions" part of your watcher definition:

  "actions": {
    "email": {
      "body": """Stats:
{{#ctx.payload.hits.hits.0}}

CPU: {{_source.cpu}}
Memory: {{_source.memory}}

{{/ctx.payload.hits.hits.0}}""",
       ...etc,
     }
  }

I'd encourage you to check out the docs on how watcher works, specifically the section on execution context which will give you more detail on the possibilities.

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