Acknowledging a service or host problem with a comment containing a newline causes the notification email to be blank with an unnamed attachment.
If the comment contains a newline, the email seems to be encoded as base64 which breaks rendering in thunderbird, evolution and also iPhone. On the desktop it's possible to download the attachment and view in a text editor, however on iphone I'm not able to view the attachment so is impossible to read the ACK message.
Provide a link to a live example, or an unambiguous set of steps to reproduce this issue. Include configuration, logs, etc. to reproduce, if relevant.
Contents of the message to be part of the email body text (as it does when there's no newlines).
If applicable, add screenshots to help explain your problem.
Include as many relevant details about the environment you experienced the problem in
icinga2 --version): r2.10.5-1[2019-09-18 14:59:37 +0100] notice/Process: Running command '/etc/icinga2/scripts/mail-host-notification.sh' '-4' '192.168.17.198' '-6' '' '-b' 'icingauser' '-c' 'host problem - no newline.' '-d' '2019-09-18 14:59:37 +0100' '-f' 'Icinga <[email protected]>' '-l' 'df-testhost' '-n' 'df-testhost' '-o' 'CRITICAL - Plugin timed out' '-r' '[email protected]' '-s' 'DOWN' '-t' 'ACKNOWLEDGEMENT' '-v' 'false': PID 13656
[2019-09-18 14:50:44 +0100] notice/Process: Running command '/etc/icinga2/scripts/mail-host-notification.sh' '-4' '192.168.17.198' '-6' '' '-b' 'icingauser' '-c' 'host problem\r\nwith newline' '-d' '2019-09-18 14:50:44 +0100' '-f' 'Icinga <[email protected]>' '-l' 'df-testhost' '-n' 'df-testhost' '-o' 'CRITICAL - Plugin timed out' '-r' '[email protected]' '-s' 'DOWN' '-t' 'ACKNOWLEDGEMENT' '-v' 'false': PID 29353
```From: Icinga icinga@mydomain.com
To: [email protected]
Subject: [ACKNOWLEDGEMENT] Current Load on df-testhost is
CRITICAL!
User-Agent: Heirloom mailx 12.5 7/5/10
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
Service Monitoring on icinga.mydomain.com
Current Load on df-testhost is CRITICAL!
Info: connect to address 192.168.17.198 port 5666: Connection refuse=
d
connect to host 192.168.xx.xx port 5666: Connection refused
When: 2019-09-18 14:05:00 +0100
Service: Current Load
Host: df-testhost
IPv4: 192.168.xx.x
Comment by icingauser:
this is also an ack!=
#### with newline:
```From: Icinga <[email protected]>
To: [email protected]
Subject: [ACKNOWLEDGEMENT] ntp on df-testhost is CRITICAL!
User-Agent: Heirloom mailx 12.5 7/5/10
MIME-Version: 1.0
Content-Type: application/octet-stream
Content-Transfer-Encoding: base64
KioqKiogU2VydmljZSBNb25pdG9yaW5nIG9uIGljaW5nYS5teWRvbWFpbi5jb20gKioqKioKCm50
cCBvbiBkZi10ZXN0aG9zdCBpcyBDUklUSUNBTCEKCkluZm86ICAgIGNvbm5lY3QgdG8gYWRkcmVz
cyAxOTIuMTY4Lnh4Lnh4IHBvcnQgNTY2NjogQ29ubmVjdGlvbiByZWZ1c2VkCmNvbm5lY3QgdG8g
aG9zdCAxOTIuMTY4Lnh4Lnh4IHBvcnQgNTY2NjogQ29ubmVjdGlvbiByZWZ1c2VkCgpXaGVuOiAg
ICAyMDE5LTA5LTE4IDE0OjA1OjEyICswMTAwClNlcnZpY2U6IG50cApIb3N0OiAgICBkZi10ZXN0
aG9zdApJUHY0OiAgICAxOTIuMTY4Lnh4Lnh4CgpDb21tZW50IGJ5IGljaW5nYXVzZXI6CiAgYW5k
IHRoaXMsIG9uY2UgYWdhaW4sIGlzIGFuIGFjay4KdGhpcyB0aW1lIHdpdGggYSBuZXdsaW5l
Hopefully my attempts to redact the information haven't caused any confusion
Thanks, we'll look into this after 2.11 has been released.
We had similar problems with non-us-ascii characters and there are solutions tested in https://github.com/Icinga/icinga2/pull/6369. Can you @BuildTheRobots have a look into this and test if this also solves your problem? If so it would be a good reason to move this approach forward.
I've tested with the new mail-host-noficiation.sh script as linked in #6369 and it seems to make the situation significantly worse.
The standard host down notifications now include half the headers inside the email body (though all in ascii) and the multi-line ack now has ascii headers and a base64 encoded blob.
This is still on centos-7. The only change made is swapping out the host notify script.
Screenshots are from thunderbird, same display issues in Evolution and on iPhone.


From what I understand the reporter uses Icinga 2.10.5, while 2.11.0 got my fix #7184, which should address the reported issue. Further on the reporter refers to the body while #6369 refers to the headers. My suggestion would be to test my fix from #7184 on 2.10.5 as it's supposed to address it.
I'll be back in the office middle of next week and will test the fix in #7184 then. Thank you :)
Can confirm that the updated scripts in #7184 (which also seem to have mainlined into centos) seem to have fixed the newline issue.
Greatest of thanks :)
Most helpful comment
From what I understand the reporter uses Icinga 2.10.5, while 2.11.0 got my fix #7184, which should address the reported issue. Further on the reporter refers to the body while #6369 refers to the headers. My suggestion would be to test my fix from #7184 on 2.10.5 as it's supposed to address it.