Page 1 of 2

SMS sending

Posted: Tue Feb 20, 2018 5:04 am
by junkertf
Hello,

I testing currently the XI sms sending functionality.

Configured the neccessary "Mobile Carrier", email settings, user profile "Noticifation Method" for it.
And i try to send a test notification, unsuccessfull.
The error message:

Feb 20 07:28:31 smtpt postfix/smtp[15682]: F2D6917D: to=<[email protected]>, relay=sms.xxxx.hu[192.168.15.1]:25, delay=6.4, del
ays=0/0.04/6/0.29, dsn=5.0.0, status=bounced (host sms.xxxx.hu[192.168.15.1] said: 503 MIME Content-Type: Multipart not accepted. Accept only plain/text. (in reply to end of DATA command))

I experience, that the XI use the configured smtp server to send the SMS to the configured number.

My questions:
- is there other method to access the same smsGW like the smtp method (for example: directly adressed)?
- is there other method to send out the sms messages to somewhere else (put down on the server in a file)?
- is there a supported method to send the sms's in plain text (not multipart)?


Thank you, Best regards,

Ferenc

Re: SMS sending

Posted: Tue Feb 20, 2018 11:23 am
by mcapra
I'm pretty sure the current Nagios XI implementation for dispatching emails guarantees multipart. I am absolutely not a PHPMailer expert though.

A solution might be to add an AltBody to the PHPMailer object created on the back-end:
https://stackoverflow.com/questions/225 ... php-mailer

Kinda strange that the email-to-sms gateway refuses anything that doesn't come in as plain-text given that most of them handle the conversion if able.

Re: SMS sending

Posted: Tue Feb 20, 2018 4:37 pm
by tgriep
There is not a way to change the way emails are sent from the XI GUI when using the PHPMailer.

You could setup the Nagios server to send emails using the Sendmail method for sending emails and set the Postfix daemon to forward emails to your SMTP gateway.
Then change the Notification commands for the contacts to use the notify-host-by-email and the notify-service-by-email commands and that should send the emails as text.

Would that work for you?

Re: SMS sending

Posted: Wed Feb 21, 2018 12:21 am
by junkertf
Thank you tgriep!


In that case the sendmail process, if there is huge number of notification, will be also a performance degrading factor on nagios xi server...?

I run a circle with these possibilities, also asking the sms gw maintenancer that is there any option to send letters in multipart!

Came back with the answers :)


Regards,

Ferenc

Re: SMS sending

Posted: Wed Feb 21, 2018 9:43 am
by mcapra
I would assert this could be a feature request. A "send as plain text" option seems useful.

Re: SMS sending

Posted: Wed Feb 21, 2018 12:24 pm
by tgriep
The load on the system shouldn't increase too much on the server when changing the method of sending SMS messages.
It is still sending the Notifications that would of used the PHPMailer to use the mailx command to send to the Postfix daemon and that should not add too much load.

Re: SMS sending

Posted: Tue Feb 27, 2018 2:46 am
by junkertf
Hello,

I had switched the XI to sendmail with success, the alerts coming still in email format.

Also tried to change the notify commands to send the message as plain/text without any success..
The smsgw still give back

said: 503 MIME Content-Type: Multipart not accepted. Accept only plain/text. (in reply to end of DATA command))

Can someone help me howto change the notify command to "send the emails as text."

Also i found that thread in support forum:

https://support.nagios.com/forum/viewto ... 16&t=42198

Can someone share with me what was the solution in that case?

best regards,

Ferenc

Re: SMS sending

Posted: Tue Feb 27, 2018 1:57 pm
by tgriep
The solution that they took was to downgrade the phpmailer to an old version that did not send the emails in multipart format and that isn't a supported solution as any upgrades in the future, would require the downgrade.
Also, if XI uses some functionality in the new version of the PHPMailer, that would cause issues if it was not there because of the downgrade.

If you are still using the XI Notification commands, this file will have to be modified to force the PHPMailer to send plain text.
Edit this file /usr/local/nagiosxi/html/includes/phpmailer/class.phpmailer.php on the nagios server and around line 1264 change the following from

Code: Select all

$this->ContentType = 'multipart/alternative';
to

Code: Select all

$this->ContentType = 'text/plain';
Save the file and see if the system starts to send the emails as plain text.

If not, we will need to see the full email header to see what they are getting sent as.

FYI, if you upgrade XI, you may have to but the change back in to that file.

Re: SMS sending

Posted: Wed Feb 28, 2018 5:14 am
by junkertf
Hello,

Made the change, but no success...

# sed -n "1264 p" /usr/local/nagiosxi/html/includes/phpmailer/class.phpmailer.php
$this->ContentType = 'text/plain';

Feb 28 09:24:02 smtpp postfix/smtp[25013]: 22758183: to=<[email protected]>, relay=sms.yyyyyyyy.hu[IP1]:25, delay=0.63, delays=0/0/0.26/0.37, dsn=5.0.0, status=bounced (host sms.yyyyyyyy.hu[IP1] said: 503 MIME Content-Type: Multipart not accepted. Accept only plain/text. (in reply to end of DATA command))

Also tried to change the sendmail back to smtp with that settings also no success..

Feb 28 10:26:17 smtpt postfix/smtp[3176]: ED779BA: to=<[email protected]>, relay=sms.yyyyyyyy.hu[IP1]:25, delay=0.64, delays=0/0.03/0.25/0.35, dsn=5.0.0, status=bounced (host sms.yyyyyyyy.hu[IP1] said: 503 MIME Content-Type: Multipart not accepted. Accept only plain/text. (in reply to end of DATA command))

I had attached a header from one of the letters from the today tested ones (still multipart)...

Best regards,

Ferenc

Re: SMS sending

Posted: Wed Feb 28, 2018 12:07 pm
by scottwilkerson
mcapra wrote:I would assert this could be a feature request. A "send as plain text" option seems useful.
This is what we are going to have to do. I verified in the code that HTML code that forces and even if there was a work around, there is also additional code that adds <br> instead of newlines.

I will add the Feature request to the developers queue, but I do not have another workaround at this time.