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

notify-{service,host}-mail: Icinga logo cannot be displayed #790

Open
5 of 8 tasks
bence-haris opened this issue Nov 20, 2024 · 0 comments
Open
5 of 8 tasks

notify-{service,host}-mail: Icinga logo cannot be displayed #790

bence-haris opened this issue Nov 20, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@bence-haris
Copy link

bence-haris commented Nov 20, 2024

This issue respects the following points:

Which variant of the Monitoring Plugins do you use?

  • .rpm/.deb package from repo.linuxfabrik.ch
  • Compiled for Linux (.tar/.zip from download.linuxfabrik.ch)
  • Compiled for Windows (from download.linuxfabrik.ch)
  • Source Code from GitHub

Bug description

When using both host and service notification plugins, sent mails don't have icinga image embedded in html, but rather sent as an attachment (base64 encoded string).

Issue seems to be systems having relatively long hostname (in our case it is a 92 character long name, including multiple hyphens), which results in incorrect Content-ID in the MIME Header, like the following:

Content-Type: icinga/png
Content-Transfer-Encoding: base64
Content-ID: =?utf-8?q?=3C173029044628=2E4046357=2E135608162032178388=40de136?=
=?utf-8?q?1-...SNIP....=3E?=
MIME-Version: 1.0
Content-Disposition: inline

There's however a correct Header for systems with shorter Hostnames (8 characters, without hyphens), such as below:

Content-Type: icinga/png
Content-Transfer-Encoding: base64
Content-ID: <173036783636.3431.18294001565118557038@SHORTER_HOSTNAME>
MIME-Version: 1.0
Content-Disposition: inline
  1. I believe issue is in the python script where logo_cid is generated (notify-host-mail: line 465)
  2. Function make_msgid() from email.utils without arguments is using socket.getfqdn() to get the domain, which has a known issue described here
    email.utils.make_msgid return ids that break email messages with related content python/cpython#100293

As a workaround, we're currently using the python scripts with make_msgid(domain="<shorter_name>"), that way images are embedded correctly.

Steps to reproduce - Plugin call

/usr/lib64/nagios/plugins/notifications/notify-host-mail --datetime --host-displayname <host_name> --mail-recipient <recipient_address> --mail-sender <sender_address> --host-state <state_num>

Steps to reproduce - Data

  1. Execute plugin

Environment

Ubuntu Linux 22.04.5 LTS x86_64

Plugin Version

v2023112901

Python version

No response

List of Python modules

No response

Additional Information

No response

@bence-haris bence-haris added the bug Something isn't working label Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant