elastalert-kibana-plugin icon indicating copy to clipboard operation
elastalert-kibana-plugin copied to clipboard

ProcessController: ERROR:root:Could not load rule & Error connecting to SMTP host: [Errno 111] Connection refused

Open man-chen-TW opened this issue 6 years ago • 0 comments

I have a yaml , I use elastalert:3.0.0-beta.0 on docker, elasticsearch 7.2

name: Mantest index: log-* filter:

  • query: query_string: query: "." alert:
  • "email" alert_text: "Test" email:
  • "[email protected]" smtp_host: "mail.com.tw" smtp_port: 587 smtp_auth_file: /opt/elastalert-server/smtp_auth_file.yaml from_addr: [email protected]

but my cosole have two error,

  1. ProcessController: ERROR:root:Could not load rule rules/ManTestQ.yaml: Invalid Rule file: rules/ManTestQ.yaml {'index': 'log-', 'name': 'Mantest', 'from_addr': '[email protected]', 'smtp_host': 'TTYMS01.tty.com.tw', 'smtp_port': 587, 'smtp_auth_file': '/opt/elastalert-server/smtp_auth_file.yaml', 'alert': ['email'], 'filter': [{'query_string': {'query': '.*'}, 'query': None}], 'rule_file': 'rules/ManTestQ.yaml', 'alert_text': 'Test', 'email': ['[email protected]']} is valid under each of {'required': [], 'properties': {'terms_window_size': {'additionalProperties': False, 'type': 'object', 'properties': {'hours': {'type': 'number'}, 'schedule': {'type': 'string'}, 'seconds': {'type': 'number'}, 'weeks': {'type': 'number'}, 'minutes': {'type': 'number'}, 'days': {'type': 'number'}, 'milliseconds': {'type': 'number'}}}, 'type': {'enum': ['new_term']}, 'fields': {'items': {'type': ['string', 'array']}, 'type': ['string', 'array']}, 'use_terms_query': {'type': 'boolean'}, 'alert_on_missing_field': {'type': 'boolean'}, 'terms_size': {'type': 'integer'}}, 'title': 'New Term'}, {'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': {},
                     'mattermostField': {'additionalProperties': False,
                                         'properties': {'args': {'items': {'type': 'string'},
                                                                 'type': ['string',
                                                                          'array']},
                                                        'short': {'type': 'boolean'},
                                                        'title': {'type': 'string'},
                                                        'value': {'type': 'string'}},
                                         'type': 'object'},
                     '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': {'items': {'type': 'string'},
                                               'type': ['string',
                                                        'array']},
                               'type': {'enum': ['blacklist']}},
                'required': ['blacklist', 'compare_key'],
                'title': 'Blacklist'},
               {'properties': {'compare_key': {'items': {'type': 'string'},
                                               'type': ['string',
                                                        'array']},
                               'ignore_null': {'type': 'boolean'},
                               'type': {'enum': ['whitelist']},
                               'whitelist': {'items': {'type': 'string'},
                                             'type': 'array'}},
                'required': ['whitelist', 'compare_key', 'ignore_null'],
                'title': 'Whitelist'},
               {'properties': {'compare_key': {'items': {'type': 'string'},
                                               'type': ['string',
                                                        'array']},
                               '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'},
               {'properties': {'attach_related': {'type': 'boolean'},
                               'doc_type': {'type': 'string'},
                               'num_events': {'type': 'integer'},
                               'terms_size': {'type': 'integer'},
                               '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': ['frequency']},
                               'use_count_query': {'type': 'boolean'},
                               'use_terms_query': {'type': 'boolean'}},
                'required': ['num_events', 'timeframe'],
                'title': 'Frequency'},
               {'properties': {'alert_on_new_data': {'type': 'boolean'},
                               'doc_type': {'type': 'string'},
                               'spike_height': {'type': 'number'},
                               'spike_type': {'enum': ['up',
                                                       'down',
                                                       'both']},
                               'terms_size': {'type': 'integer'},
                               'threshold_cur': {'type': 'integer'},
                               'threshold_ref': {'type': 'integer'},
                               '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': ['spike']},
                               'use_count_query': {'type': 'boolean'},
                               'use_terms_query': {'type': 'boolean'}},
                'required': ['spike_height', 'spike_type', 'timeframe'],
                'title': 'Spike'},
               {'properties': {'alert_on_new_data': {'type': 'boolean'},
                               'doc_type': {'type': 'string'},
                               'metric_agg_type': {'enum': ['min',
                                                            'max',
                                                            'avg',
                                                            'sum',
                                                            'cardinality',
                                                            'value_count']},
                               'min_doc_count': {'type': 'integer'},
                               'spike_height': {'type': 'number'},
                               'spike_type': {'enum': ['up',
                                                       'down',
                                                       'both']},
                               'terms_size': {'type': 'integer'},
                               'threshold_cur': {'type': 'number'},
                               'threshold_ref': {'type': 'number'},
                               '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': ['spike_aggregation']},
                               'use_count_query': {'type': 'boolean'},
                               'use_terms_query': {'type': 'boolean'}},
                'required': ['spike_height', 'spike_type', 'timeframe'],
                'title': 'Spike Aggregation'},
               {'properties': {'doc_type': {'type': 'string'},
                               'threshold': {'type': 'integer'},
                               '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': ['flatline']},
                               'use_count_query': {'type': 'boolean'}},
                'required': ['threshold', 'timeframe'],
                'title': 'Flatline'},
               {'properties': {'alert_on_missing_field': {'type': 'boolean'},
                               'fields': {'items': {'type': ['string',
                                                             'array']},
                                          'type': ['string', 'array']},
                               'terms_size': {'type': 'integer'},
                               'terms_window_size': {'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': ['new_term']},
                               'use_terms_query': {'type': 'boolean'}},
                'required': [],
                'title': 'New Term'},
               {'properties': {'cardinality_field': {'type': 'string'},
                               'max_cardinality': {'type': 'integer'},
                               'min_cardinality': {'type': 'integer'},
                               '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': ['cardinality']}},
                'required': ['cardinality_field', 'timeframe'],
                'title': 'Cardinality'},
               {'properties': {'metric_agg_type': {'enum': ['min',
                                                            'max',
                                                            'avg',
                                                            'sum',
                                                            'cardinality',
                                                            'value_count']},
                               'type': {'enum': ['metric_aggregation']}},
                'required': ['metric_agg_key', 'metric_agg_type'],
                'title': 'Metric Aggregation'},
               {'properties': {'type': {'enum': ['percentage_match']}},
                'required': ['match_bucket_filter'],
                'title': 'Percentage Match'},
               {'properties': {'type': {'pattern': '[.]'}},
                'title': 'Custom Rule from Module'}],
     'properties': {'aggregation': {'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'},
                    'alert_missing_value': {'type': 'string'},
                    'alert_text': {'type': 'string'},
                    'alert_text_args': {'items': {'type': 'string'},
                                        'type': 'array'},
                    'alert_text_kw': {'type': 'object'},
                    'alert_text_type': {'enum': ['alert_text_only',
                                                 'exclude_fields',
                                                 'aggregation_summary_only']},
                    'alerta_api_key': {'type': 'string'},
                    'alerta_api_url': {'type': 'string'},
                    'alerta_attributes_keys': {'items': {'type': 'string'},
                                               'type': 'array'},
                    'alerta_attributes_values': {'items': {'type': 'string'},
                                                 'type': 'array'},
                    'alerta_correlate': {'items': {'type': 'string'},
                                         'type': 'array'},
                    'alerta_customer': {'type': 'string'},
                    'alerta_environment': {'type': 'string'},
                    'alerta_event': {'type': 'string'},
                    'alerta_group': {'type': 'string'},
                    'alerta_new_style_string_format': {'type': 'boolean'},
                    'alerta_origin': {'type': 'string'},
                    'alerta_resource': {'type': 'string'},
                    'alerta_service': {'items': {'type': 'string'},
                                       'type': 'array'},
                    'alerta_severity': {'enum': ['unknown',
                                                 'security',
                                                 'debug',
                                                 'informational',
                                                 'ok',
                                                 'normal',
                                                 'cleared',
                                                 'indeterminate',
                                                 'warning',
                                                 'minor',
                                                 'major',
                                                 'critical']},
                    'alerta_tags': {'items': {'type': 'string'},
                                    'type': 'array'},
                    'alerta_text': {'type': 'string'},
                    'alerta_type': {'type': 'string'},
                    'alerta_value': {'type': 'string'},
                    'buffer_time': {'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'},
                    'command': {'items': {'type': 'string'},
                                'type': ['string', 'array']},
                    'email': {'items': {'type': 'string'},
                              'type': ['string', 'array']},
                    'email_reply_to': {'type': 'string'},
                    'es_host': {'type': 'string'},
                    'es_password': {'type': 'string'},
                    'es_port': {'type': 'integer'},
                    'es_username': {'type': 'string'},
                    'exotel_account_sid': {'type': 'string'},
                    'exotel_auth_token': {'type': 'string'},
                    'exotel_from_number': {'type': 'string'},
                    'exotel_to_number': {'type': 'string'},
                    'exponential_realert': {'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'},
                    'fail_on_non_zero_exit': {'type': 'boolean'},
                    'field': {},
                    'filter': {'additionalProperties': False,
                               'items': {},
                               'properties': {'download_dashboard': {'type': 'string'}},
                               'type': ['array', 'object']},
                    'from_addr': {'type': 'string'},
                    'generate_kibana_link': {'type': 'boolean'},
                    'gitter_msg_level': {'enum': ['info', 'error']},
                    'gitter_proxy': {'type': 'string'},
                    'gitter_webhook_url': {'type': 'string'},
                    'hipchat_auth_token': {'type': 'string'},
                    'hipchat_domain': {'type': 'string'},
                    'hipchat_from': {'type': 'string'},
                    'hipchat_ignore_ssl_errors': {'type': 'boolean'},
                    'hipchat_mentions': {'items': {'type': 'string'},
                                         'type': 'array'},
                    'hipchat_notify': {'type': 'boolean'},
                    'hipchat_room_id': {'type': ['string', 'integer']},
                    'import': {'type': 'string'},
                    'include': {'items': {'type': 'string'},
                                'type': 'array'},
                    'index': {'type': 'string'},
                    'jira_account_file': {'type': 'string'},
                    'jira_assignee': {'type': 'string'},
                    'jira_bump_in_statuses': {'items': {'type': 'string'},
                                              'type': ['string',
                                                       'array']},
                    'jira_bump_not_in_statuses': {'items': {'type': 'string'},
                                                  'type': ['string',
                                                           'array']},
                    'jira_bump_tickets': {'type': 'boolean'},
                    'jira_component': {'items': {'type': 'string'},
                                       'type': ['string', 'array']},
                    'jira_components': {'items': {'type': 'string'},
                                        'type': ['string', 'array']},
                    'jira_issuetype': {'type': 'string'},
                    'jira_label': {'items': {'type': 'string'},
                                   'type': ['string', 'array']},
                    'jira_labels': {'items': {'type': 'string'},
                                    'type': ['string', 'array']},
                    'jira_max_age': {'type': 'number'},
                    'jira_project': {'type': 'string'},
                    'jira_server': {'type': 'string'},
                    'jira_watchers': {'items': {'type': 'string'},
                                      'type': ['string', 'array']},
                    'kibana_dashboard': {'type': 'string'},
                    'linenotify_access_token': {'type': 'string'},
                    'match_enhancements': {'items': {'type': 'string'},
                                           'type': 'array'},
                    'mattermost_channel_override': {'type': 'string'},
                    'mattermost_icon_url_override': {'type': 'string'},
                    'mattermost_ignore_ssl_errors': {'type': 'boolean'},
                    'mattermost_msg_color': {'enum': ['good',
                                                      'warning',
                                                      'danger']},
                    'mattermost_msg_fields': {'additionalProperties': False,
                                              'properties': {'args': {'items': {'type': 'string'},
                                                                      'type': ['string',
                                                                               'array']},
                                                             'short': {'type': 'boolean'},
                                                             'title': {'type': 'string'},
                                                             'value': {'type': 'string'}},
                                              'type': 'object'},
                    'mattermost_msg_pretext': {'type': 'string'},
                    'mattermost_proxy': {'type': 'string'},
                    'mattermost_username_override': {'type': 'string'},
                    'mattermost_webhook_url': {'items': {'type': 'string'},
                                               'type': ['string',
                                                        'array']},
                    'max_query_size': {'type': 'integer'},
                    'name': {'type': 'string'},
                    'notify_email': {'items': {'type': 'string'},
                                     'type': ['string', 'array']},
                    'owner': {'type': 'string'},
                    'pagerduty_client_name': {'type': 'string'},
                    'pagerduty_event_type': {'enum': ['none',
                                                      'trigger',
                                                      'resolve',
                                                      'acknowledge']},
                    'pagerduty_service_key': {'type': 'string'},
                    'pagertree_integration_url': {'type': 'string'},
                    'pipe_match_json': {'type': 'boolean'},
                    'priority': {'type': 'integer'},
                    'query_delay': {'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'},
                    'query_key': {'items': {'type': 'string'},
                                  'type': ['string', 'array']},
                    'raw_count_keys': {'type': 'boolean'},
                    'realert': {'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'},
                    'replace_dots_in_field_names': {'type': 'boolean'},
                    'scan_entire_timeframe': {'type': 'boolean'},
                    'simple_proxy': {'type': 'string'},
                    'simple_webhook_url': {'items': {'type': 'string'},
                                           'type': ['string', 'array']},
                    'slack_ca_certs': {'type': 'string'},
                    'slack_emoji_override': {'type': 'string'},
                    'slack_icon_url_override': {'type': 'string'},
                    'slack_ignore_ssl_errors': {'type': 'boolean'},
                    'slack_msg_color': {'enum': ['good',
                                                 'warning',
                                                 'danger']},
                    'slack_parse_override': {'enum': ['none', 'full']},
                    'slack_text_string': {'type': 'string'},
                    'slack_username_override': {'type': 'string'},
                    'slack_webhook_url': {'items': {'type': 'string'},
                                          'type': ['string', 'array']},
                    'smtp_host': {'type': 'string'},
                    'stride_access_token': {'type': 'string'},
                    'stride_cloud_id': {'type': 'string'},
                    'stride_conversation_id': {'type': 'string'},
                    'stride_ignore_ssl_errors': {'type': 'boolean'},
                    'telegram_api_url': {'type': 'string'},
                    'telegram_bot_token': {'type': 'string'},
                    'telegram_room_id': {'type': 'string'},
                    'timestamp_field': {'type': 'string'},
                    'top_count_keys': {'items': {'type': 'string'},
                                       'type': 'array'},
                    'top_count_number': {'type': 'integer'},
                    'twilio_account_sid': {'type': 'string'},
                    'twilio_auth_token': {'type': 'string'},
                    'twilio_from_number': {'type': 'string'},
                    'twilio_to_number': {'type': 'string'},
                    'use_kibana_dashboard': {'type': 'string'},
                    'use_local_time': {'type': 'boolean'},
                    'use_ssl': {'type': 'boolean'},
                    'use_strftime_index': {'type': 'boolean'},
                    'verify_certs': {'type': 'boolean'},
                    'victorops_api_key': {'type': 'string'},
                    'victorops_entity_display_name': {'type': 'string'},
                    'victorops_entity_id': {'type': 'string'},
                    'victorops_message_type': {'enum': ['INFO',
                                                        'WARNING',
                                                        'ACKNOWLEDGEMENT',
                                                        'CRITICAL',
                                                        'RECOVERY']},
                    'victorops_routing_key': {'type': 'string'}},
     'required': ['type', 'index', 'alert'],
     'type': 'object'}

On instance:

{'alert': ['email'], 'alert_text': 'Test', 'email': ['[email protected]'], 'filter': [{'query': None, 'query_string': {'query': '.'}}], 'from_addr': '[email protected]', 'index': 'log-*', 'name': 'Mantest', 'rule_file': 'rules/ManTestQ.yaml', 'smtp_auth_file': '/opt/elastalert-server/smtp_auth_file.yaml', 'smtp_host': 'mail.com.tw', 'smtp_port': 587}

  1. ERROR:root:Error connecting to SMTP host: [Errno 111] Connection refused (but I can ping and telnet the mailserver)

please comment about error or told me how to revised error,

Tks,

Man

man-chen-TW avatar Oct 05 '19 01:10 man-chen-TW