Closed vicvinodvic closed 1 year ago
Using below Code resolved the Issue from elastalert.enhancements import BaseEnhancement
class PsdEnhancement(BaseEnhancement):
# The enhancement is run against every match
# The match is passed to the process function where it can be modified in any way
# ElastAlert 2 will do this for each enhancement linked to a rule
def process(self, match):
self.rule['alertmanager_labels']['categoryid'] = match['categoryid']
I have created a custom rule which alerts when particular category ids' API status has more than 90% failure. Below is the code, I want to send categoryid as alertmanager_fields , but its going null, please help me in fixing the issue Rule configuration alert:
alertmanager_hosts:
I have tried below combination categoryid: "{{ match.categoryid }}" categoryid: "match.categoryid" categoryid: "match[categoryid]"
Custom Rule code from elastalert.ruletypes import RuleType from datetime import datetime, timedelta from jinja2 import Template
template_string = """
For Category {{ match['categoryid'] }}, more than {{ match['threshold'] }}% Rreq Failures
Total Txns : {{ match['total_transactions'] }} Failed Txns : {{ match['failed_transactions'] }}
"""
class RreqRule(RuleType):