Willam Marston
Willam Marston

Reputation: 97

elastalert not sending out email

I set up elastic alert on a Docker image, and trying to send the email through gmail smtp server, but keeps getting errors

My config.yaml file is:

...
smtp_auth_file: /usr/local/bin/elastalert/rules/email_auth.yaml

My email authetication file is:

smtp_host: smtp.gmail.com
from_addr: [email protected]
user: "username"
password: "password"

But the error I am getting is:

util.EAException: Error loading file /usr/local/bin/elastalert/rules/email_auth.yaml: Invalid Rule: None
{'from_addr': '[email protected]', 'smtp_ssl': True, 'smtp_host': 'smtp.gmail.com', 'user': 'username', 'rule_file': '/usr/local/bin/elastalert/rules/email_auth.yaml', 'password': 'password'} is valid under each of {'properties': {'type': {'pattern': '[.]'}}, 'title': 'Custom Rule from Module'}, {'properties': {'type': {'enum': ['any']}}, 'title': 'Any'}

Failed validating 'oneOf' in schema:
    {'$schema': 'http://json-schema.org/draft-04/schema#',
     'definitions': {'arrayOfStrings': {'items': {'type': 'string'},
                                        'type': ['string', 'array']},
                     'arrayOfStringsOrOtherArrays': {'items': {'type': ['string',
                                                                        'array']},
                                                     'type': ['string',
                                                              'array']},
                     'filter': {},
                     'timeFrame': {'additionalProperties': False,
                                   'properties': {'days': {'type': 'number'},
                                                  'hours': {'type': 'number'},
                                                  'milliseconds': {'type': 'number'},
                                                  'minutes': {'type': 'number'},
                                                  'schedule': {'type': 'string'},
                                                  'seconds': {'type': 'number'},
                                                  'weeks': {'type': 'number'}},
                                   'type': 'object'}},
     'oneOf': [{'properties': {'type': {'enum': ['any']}},
                'title': 'Any'},
               {'properties': {'blacklist': {'items': {'type': 'string'},
                                             'type': 'array'},
                               'compare_key': {'type': 'string'},
                               'type': {'enum': ['blacklist']}},
                'required': ['blacklist', 'compare_key'],
                'title': 'Blacklist'},
               {'properties': {'compare_key': {'type': 'string'},
                               'ignore_null': {'type': 'boolean'},
                               'type': {'enum': ['whitelist']},
                               'whitelist': {'items': {'type': 'string'},
                                             'type': 'array'}},
                'required': ['whitelist', 'compare_key', 'ignore_null'],
                'title': 'Whitelist'},
               {'properties': {'compare_key': {'type': 'string'},
                               'ignore_null': {'type': 'boolean'},
                               'timeframe': {'additionalProperties': False,
                                             'properties': {'days': {'type': 'number'},
                                                            'hours': {'type': 'number'},
                                                            'milliseconds': {'type': 'number'},
                                                            'minutes': {'type': 'number'},
                                                            'schedule': {'type': 'string'},
                                                            'seconds': {'type': 'number'},
                                                            'weeks': {'type': 'number'}},
                                             'type': 'object'},
                               'type': {'enum': ['change']}},
                'required': ['query_key', 'compare_key', 'ignore_null'],
                'title': 'Change'},

I checked the elastalert/config.py and schma.yaml, and found the smtp_auth_file, user and password property are not even defined in schma.yaml. Is that what causes the valifation error? Anyone knows where did my setup go wrong? Thanks

Upvotes: 0

Views: 2300

Answers (1)

Willam Marston
Willam Marston

Reputation: 97

I found the problem. I put my email_authentication.yaml in the same folder of my rule_folder. Once I moved it out, this error was solved.

Upvotes: 1

Related Questions