Icinga / icinga-notifications

Icinga Notifications: new and improved notifications and incident management for Icinga (work in progress, not ready for production yet)
GNU General Public License v2.0
9 stars 0 forks source link

Log a failure if notification transmission is not possible due to a missing address #214

Open nilmerg opened 3 weeks ago

nilmerg commented 3 weeks ago

At the moment, if a contact has no email address and should be / will be notified by email, an incident's history logs that an escalation has been reached, but no further log exists explaining what didn't happen.

yhabteab commented 3 weeks ago

Why does the web allow you to create users without an email address in the first place, when you expect that the daemon should treat this as an error? IMHO, web should force you to provide your email address if you choose email as a default channel and shouldn't delegate the error handling to the daemon.

nilmerg commented 3 weeks ago

Only the default is required or will be: https://github.com/Icinga/icinga-notifications-web/issues/74

julianbrost commented 3 weeks ago

At the moment, if a contact has no email address and should be / will be notified by email, an incident's history logs that an escalation has been reached, but no further log exists explaining what didn't happen.

In that situation, I'd expect a history entry with notification_state = 'failed'. If that currently results in the entry remaining either pending or even being marked as sent, this sounds like a bug.

nilmerg commented 3 weeks ago

There's no entry at all.

julianbrost commented 3 weeks ago

That sounds even more like a bug.

yhabteab commented 3 weeks ago

There's no entry at all.

No way!

2024-06-10T12:12:12.928+0200    INFO    incident    Rule reached escalation {"object": "icinga-8!ping4", "incident": "#26", "rule": {"id": 1, "name": "default"}, "escalation": {"id": 1, "rule_id": 1, "name": "[S] Working Hours, [C] Yonas Habteab", "condition": "incident_severity>=ok"}}
2024-06-10T12:12:12.953+0200    INFO    incident    Notify contact "Yonas Habteab" via "Email" of type "email"  {"object": "icinga-8!ping4", "incident": "#26", "channel_id": 1, "event_type": "state"}
2024-06-10T12:12:12.954+0200    ERROR   incident    Failed to send notification via channel plugin  {"object": "icinga-8!ping4", "incident": "#26", "type": "email", "error": "contact user Yonas Habteab doesn't have an e-mail address"}
Bildschirmfoto 2024-06-10 um 12 17 43
nilmerg commented 3 weeks ago

Please also test this with a manual subscribe.

yhabteab commented 3 weeks ago

Please also test this with a manual subscribe.

You didn't say that in your issue description, but either way works for me!

2024-06-10T14:34:17.916+0200    INFO    incident    Notify contact "Icinga Admin" via "Email" of type "email"   {"object": "docker-master!swap", "incident": "#10", "channel_id": 1, "event_type": "state"}
2024-06-10T14:34:17.917+0200    ERROR   incident    Failed to send notification via channel plugin  {"object": "docker-master!swap", "incident": "#10", "type": "email", "error": "contact user Icinga Admin doesn't have an e-mail address"}
Bildschirmfoto 2024-06-10 um 14 37 49