Closed alexd124641 closed 2 years ago
Hey, having the same issue. I see that 'alerta-mailer'
shouldn't be in PLUGINS
in your alertad.conf
because it is not a plugin. That's one thing. Otherwise, I do not know, I have the exact same issue and I am not getting any logging at all. I suspect the logic is not even running because there are plenty of debug statements in the code...
It's been suggested that maybe mongodb is the source of the issue....I will try Redis soon.
Also, no "..."
double quote lines in your alerta.conf
was an issue I had to learn the hard way...
I will try Redis soon.
Ok, it's not simple and I am not sure how to do it since it now complains about a missing redis back-end and I see there is no documentation to show it is supported? Docs state that mongodb is supported but it is somehow problematic here for reasons unknown? I am sure that everything is working on my end now in terms of configuration and settings (see https://git.autonomic.zone/coop-cloud/alerta, docker swarm setup) and I am wondering how to go about investigating if Mongodb really is the issue?
OK fuck it, I couldn't resist more pain, using redis worked...
Kombu is the AMQP python package used to implement the mailer
queue and it supports a number of different "transports" (aka. backends). See https://docs.celeryproject.org/projects/kombu/en/stable/introduction.html#transport-comparison
Well the MongoDB transport is broken for the mailer queue as far as I can see.
Dear @decentral1se, @satterly
I tried also but cannot make it working even with redis. I see that messages are published (amqp plugin logs)... The mailer is connected also... but no mail sent...
I don't know how to debug it....
Best.
I tried Mongo transport for mailer, 2 weeks ago and is working. OS ubuntu.bionic64 Docker environment, mongodb localy installed in web container DB postgresql
ENV variable ALERTA_CONF_FILE=/app/alerta.conf ALERTA_SVR_CONF_FILE=/app/alertad.conf
part of the alertad.conf: there is TOPIC notify with ' .... PLUGINS = ['debug','reject','blackout','enhance','normalise','acked_by','amqp'] AMQP_URL = 'mongodb://localhost:27017/kombu' AMQP_TOPIC = 'notify'
part of the alerta.conf there is amqp_topic notify without ' ... [alerta-mailer] key = some_string ; must have "write:heartbeats" scope mail_to = mail_from = from@domain.com amqp_url = mongodb://localhost:27017/kombu amqp_topic = notify dashboard_url = http://localhost:48080 smtp_host = smtp_port = smtp_username = smtp_login_name smtp_password = smtp_login_pass smtp_starttls = True smtp_use_ssl = False debug = True skip_mta = False email_type = html
alerta-mailer rules dir /app/alerta.rules.d
simple rule file: t1_rules.conf
[ { "name": "T001", "fields": [ {"field": "resource", "regex": "Mailer_D11" } ], "contacts": ["user@example.net"] } ]
Start alerta-mailer in debug mode #alerta-mailer
then send event from different shell #alerta send -r Mailer_D11 -E Test -e MailerErr_33 -S postfix4 -s critical
and alert mailer try deliver message after 30 sec and writes debug log on console
--- debug log --- DEBUG:mailer:Looking for rules files in /app/alerta.rules.d DEBUG:mailer:Parsing t1_rules.conf INFO:mailer:Adding rule {'name': 'T001', 'fields': [{'field': 'resource', 'regex': 'Mailer_D11'}], 'contacts': ['user@example.net']} to list of rules to be evaluated INFO:kombu.mixins:Connected to mongodb://localhost:27017/kombu Connected to mongodb://localhost:27017/kombu DEBUG:urllib3.connectionpool:Starting new HTTP connection (1): localhost:8080 Starting new HTTP connection (1): localhost:8080 DEBUG:urllib3.connectionpool:http://localhost:8080 "POST /api/heartbeat HTTP/1.1" 201 297 http://localhost:8080 "POST /api/heartbeat HTTP/1.1" 201 297 DEBUG:urllib3.connectionpool:http://localhost:8080 "POST /api/heartbeat HTTP/1.1" 201 298 http://localhost:8080 "POST /api/heartbeat HTTP/1.1" 201 298 DEBUG:mailer:Initial contact list: [] Initial contact list: [] DEBUG:mailer:Checking 1 group rules Checking 1 group rules INFO:mailer:Evaluating rule T001 Evaluating rule T001 DEBUG:mailer:Evaluating rule field {'field': 'resource', 'regex': 'Mailer_D11'} Evaluating rule field {'field': 'resource', 'regex': 'Mailer_D11'} DEBUG:mailer:Trying to match Mailer_D11 to Mailer_D11 Trying to match Mailer_D11 to Mailer_D11 DEBUG:mailer:Extending contact to include ['user@example.net'] Extending contact to include ['user@example.net'] send: 'ehlo [10.8.0.2]\r\n' reply: b'250-XXXXXXXXX\r\n'
.......... SMTP conversation ....................
reply: retcode (235); Msg: b'2.7.0 Authentication successful'
send: 'mail FROM:
Read this https://github.com/alerta/alerta-contrib/tree/master/integrations/mailer , Alerts have to meet the some criterias
BR.
Hello,
I finally made it working also... the main problem is that I think that you are missing debug messages to know when a message is acknowledged for different reasons.
Best, Jerome
@jrevillard Thanks!
Issue Summary I've installed alerta (which work fine) and alerta-mailer. When I do alerta-mailer (or execute mailer.py), everything seems to be working (connection to the database and heartbeat) I can see the heartbeat in the web UI but I don't receive any email.
Environment
OS: Linux (Debian 10)
API version: 8.0.3
Deployment: self-hosted
For self-hosted, WSGI environment: nginx/uwsgi
Database: MongoDB
Server config: Auth enabled? Yes Auth provider? Basic Customer views? No
web UI version: [eg. 6.8.1]
CLI version: [eg. 6.8.1]
To Reproduce Steps to reproduce the behavior:
Expected behavior At least having a trace somewhere of the email in order to identify what is going wrong
Alerta config
Alerta.conf:
alertad.conf:
Mailer.py :
Output of either ./mailer.py or alerta-mailer:
If you need any additional info, file or command output let me know.