Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify ruletypes.rst, alerts.py, schema.yaml and add / modify test code for alerts_test.py #143

Merged
merged 2 commits into from
May 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions docs/source/ruletypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1720,6 +1720,8 @@ until the command exits or sends an EOF to stdout.
``pipe_alert_text``: If true, the standard alert body text will be passed to stdin of the command. Note that this will cause ElastAlert to block
until the command exits or sends an EOF to stdout. It cannot be used at the same time as ``pipe_match_json``.

``fail_on_non_zero_exit``: By default this is ``False``. Allows monitoring of when commands fail to run. When a command returns a non-zero exit status, the alert raises an exception.

Example usage using old-style format::

alert:
Expand Down Expand Up @@ -1905,7 +1907,7 @@ by the smtp server.

``bcc``: This adds the BCC emails to the list of recipients but does not show up in the email message. By default, this is left empty.

``email_format``: If set to ``html``, the email's MIME type will be set to HTML, and HTML content should correctly render. If you use this,
``email_format``: If set to 'html', the email's MIME type will be set to HTML, and HTML content should correctly render. If you use this,
you need to put your own HTML into ``alert_text`` and use ``alert_text_type: alert_text_jinja`` Or ``alert_text_type: alert_text_only``.

Exotel
Expand Down Expand Up @@ -2242,13 +2244,21 @@ The OpsGenie alert requires one option:
Optional:

``opsgenie_account``: The OpsGenie account to integrate with.

``opsgenie_addr``: The OpsGenie URL to to connect against, default is ``https://api.opsgenie.com/v2/alerts``

``opsgenie_recipients``: A list OpsGenie recipients who will be notified by the alert.

``opsgenie_recipients_args``: Map of arguments used to format opsgenie_recipients.

``opsgenie_default_receipients``: List of default recipients to notify when the formatting of opsgenie_recipients is unsuccesful.

``opsgenie_teams``: A list of OpsGenie teams to notify (useful for schedules with escalation).
``opsgenie_teams_args``: Map of arguments used to format opsgenie_teams (useful for assigning the alerts to teams based on some data)

``opsgenie_teams_args``: Map of arguments used to format opsgenie_teams (useful for assigning the alerts to teams based on some data).

``opsgenie_default_teams``: List of default teams to notify when the formatting of opsgenie_teams is unsuccesful.

``opsgenie_tags``: A list of tags for this alert.

``opsgenie_message``: Set the OpsGenie message to something other than the rule name. The message can be formatted with fields from the first match e.g. "Error occurred for {app_name} at {timestamp}.".
Expand Down Expand Up @@ -2673,8 +2683,11 @@ Zabbix will send notification to a Zabbix server. The item in the host specified
Required:

``zbx_sender_host``: The address where zabbix server is running.

``zbx_sender_port``: The port where zabbix server is listenning.

``zbx_host``: This field setup the host in zabbix that receives the value sent by ElastAlert 2.

``zbx_key``: This field setup the key in the host that receives the value sent by ElastAlert 2.

Example usage::
Expand Down
5 changes: 3 additions & 2 deletions elastalert/alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ def __init__(self, *args):
self.smtp_host = self.rule.get('smtp_host', 'localhost')
self.smtp_ssl = self.rule.get('smtp_ssl', False)
self.from_addr = self.rule.get('from_addr', 'ElastAlert')
self.smtp_port = self.rule.get('smtp_port')
self.smtp_port = self.rule.get('smtp_port', 25)
if self.rule.get('smtp_auth_file'):
self.get_account(self.rule['smtp_auth_file'])
self.smtp_key_file = self.rule.get('smtp_key_file')
Expand Down Expand Up @@ -1960,6 +1960,7 @@ def get_json_payload(self, match):

class HTTPPostAlerter(Alerter):
""" Requested elasticsearch indices are sent by HTTP POST. Encoded with JSON. """
required_options = frozenset(['http_post_url'])

def __init__(self, rule):
super(HTTPPostAlerter, self).__init__(rule)
Expand Down Expand Up @@ -2120,7 +2121,7 @@ def get_info(self):


class DiscordAlerter(Alerter):

""" Created a Discord for each alert """
required_options = frozenset(['discord_webhook_url'])

def __init__(self, rule):
Expand Down
Loading