How many actions can one watch have?

alerting

(Super Pringles) #1

Let's say for example that I want to create a watch that watches my system's memory use. If it has only 5% memory left I want to know about this.

Now for this watch I plan on adding an action which sends me a message via Slack or PagerDuty but I want a second action to create a ticket with relevant information into Jira. Is it possible to put this into one watch or do I have to make a "memory_use_watch_pagerduty" and a second one called "memory_use_watch_jira" while they just check the same thing?

Thanks :smile:!


(Samir Bennacer) #2

You can have multiple actions in the same watches

{
 "actions" : {
    "email_administrator" : {
      "email" : {
        "to" : "sys.admino@host.domain",
        "subject" : "Encountered {{ctx.payload.hits.total}} errors",
        "body" : "Too many error in the system, see attached data",
        "attach_data" : true,
        "priority" : "high"
      }
    },
    "notify_pager" : {
      "webhook" : {
        "method" : "POST",
        "host" : "pager.service.domain",
        "port" : 1234,
        "path" : "/{{watch_id}}",
        "body" : "Encountered {{ctx.payload.hits.total}} errors"
      }
    }
  }

(Super Pringles) #3

@ESamir and they won't interfere with each other?

Also does the order you put the actions in matter? Going by your example will the email_administrator go before the notify_pager?


(Samir Bennacer) #4

The actions are executed one at a time, Each action are executed independently from the others.


(Super Pringles) #5

I see! Thank you very much for clarifying :smile:


(system) #6