Skip to content

Conditional Threshold rule and math aggregations in Rule file #312

Closed Locked Answered by firdausa-iprogrammer
firdausa-iprogrammer asked this question in Q&A
Discussion options

You must be logged in to vote

To answer myself -

Here's my custom alerter -

from elastalert.alerts import Alerter
import subprocess
from elastalert.util import resolve_string

class fidAlerter(Alerter):
  required_options = set(['command_l1', 'command_l2', 'command_l3', 'thresh_l1_max', 'thresh_l2', 'thresh_l2_max'])
  def alert(self, matches):
      for match in matches:
        pct = match['percentage']
        thresh_l1 = self.rule['max_percentage']
        thresh_l1_max = self.rule['thresh_l1_max']
        thresh_l2 = self.rule['thresh_l2']
        thresh_l2_max = self.rule['thresh_l2_max']
        if pct >= thresh_l1 and pct <= thresh_l1_max:
          self.rule['command_l1'] = [self.rule['command_l1']]
         …

Replies: 5 comments 14 replies

Comment options

You must be logged in to vote
3 replies
@firdausa-iprogrammer
Comment options

@ferozsalam
Comment options

@firdausa-iprogrammer
Comment options

Comment options

You must be logged in to vote
2 replies
@firdausa-iprogrammer
Comment options

@ferozsalam
Comment options

Comment options

You must be logged in to vote
1 reply
@ferozsalam
Comment options

Comment options

You must be logged in to vote
3 replies
@jertel
Comment options

@firdausa-iprogrammer
Comment options

@firdausa-iprogrammer
Comment options

Answer selected by jertel
Comment options

You must be logged in to vote
5 replies
@jertel
Comment options

@firdausa-iprogrammer
Comment options

@firdausa-iprogrammer
Comment options

@jertel
Comment options

@firdausa-iprogrammer
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants