Page 4 of 5
Re: Email of multiline output
Posted: Mon Nov 22, 2021 3:06 pm
by pbroste
Hello
@hbouma
Thanks for pinging back on this one; as we recall from previous correspondence on this thread, we know that we are limited
on postfix text formatting available.
Want to find out what specific formatting you are looking to make adjustments to? Please send over an example when you get a chance.
Thanks,
Perry
Re: Email of multiline output
Posted: Tue Nov 23, 2021 1:11 pm
by hbouma
We are looking to find a way to email the information found from our check to the contact with new lines inserted between files found as opposed to the \n that is currently being inserted.
I will PM you the plugin that we are running.
Re: Email of multiline output
Posted: Wed Nov 24, 2021 11:12 am
by pbroste
Hello
@hbouma
Spun-up my test vm on this and want to verify with you that you are receiving the results from the 'check_files' script on the web console dashboard and email? Is it the format on the email that is off?
Here are the example results that I receive from my test VM for your review:
- Command:
[list]/usr/local/nagios/libexec/check_ncpa.py -H 192.168.xxx.xxx -t 'welcome' -P 5693 -M 'plugins/check_files.ps1' -q "args=C:\temp 9999"
Files modified in the last 9999 minutes. Files are:
C:\temp\check_files.ps1
C:\temp\check_tcp - Shortcut.lnk
C:\temp\New Text Document (6) - Copy - Copy - Shortcut.lnk
C:\temp\nxlog-ce-latest - Shortcut.lnk
C:\temp\op5.ini
C:\temp\putty - Shortcut.lnk
C:\temp\winrpe_5.4.0_x64_free_installer - Shortcut (2).lnk
C:\temp\winrpe_5.4.0_x64_free_installer - Shortcut.lnk
[*]Web Console:[/*]
[*]Raw email results from shell:[/*]
Delivered-To: nagios@localhost
Received: by localhost.localdomain (Postfix, from userid 1000)
id 470E8875430; Wed, 24 Nov 2021 10:06:49 -0600 (CST)
To: nagios@localhost
Subject: PROBLEM Service Alert - 192.168.xxx.xxx/Plugin check_files.ps1 is CRITICAL
X-PHP-Originating-Script: 1000:class.phpmailer.php
Date: Wed, 24 Nov 2021 10:06:49 -0600
From: Nagios XI <root@localhost>
Reply-To: Nagios XI <root@localhost>
Message-ID: <5ee57746b11e7878fad175d5b00400d0@localhost>
X-Priority: 1
X-Mailer: PHPMailer 5.2.27 (
https://github.com/PHPMailer/PHPMailer)
X-MSMail-Priority: High
Importance: High
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
***** Nagios XI Alert *****
Nagios has detected a problem with this service.
Notification Type: PROBLEM
Service: Plugin check_files.ps1
Host: 192.168.xxx.xxx
Address: 192.168.xxx.xxx
State: CRITICAL
Info:
Files modified in the last 9999 minutes. Files are:
Date/Time: 2021-11-24 10:06:49
Respond:
http://192.168.xxx.xxx/nagiosxi/rr.php? ... 8c85dd6220
Nagios URL:
http://192.168.xxx.xxx/nagiosxi/
Add: C:\temp\check_files.ps1\nC:\temp\check_tcp - Shortcut.lnk\nC:\temp\New Text Document (6) - Copy - C
opy - Shortcut.lnk\nC:\temp\nxlog-ce-latest - Shortcut.lnk\nC:\temp\op5.ini\nC:\temp\putty - Shortcut.lnk
\nC:\temp\winrpe_5.4.0_x64_free_installer - Shortcut (2).lnk\nC:\temp\winrpe_5.4.0_x64_free_installer - S
hortcut.lnk\n\n\t
[/list]
Let us know how things look from your end.
Thanks,
Perry
Re: Email of multiline output
Posted: Wed Nov 24, 2021 11:16 am
by hbouma
Correct. We see the information, but when it gets emailed, it has a \n instead of a new line from our Linux RHEL 7.9 servers.
Re: Email of multiline output
Posted: Mon Nov 29, 2021 6:37 pm
by pbroste
Hello
@hbouma
Spinning up a test VM to see what mailx will look like sending plain/text via smtp. Will follow up shortly.
Thanks,
Perry
Re: Email of multiline output
Posted: Tue Nov 30, 2021 3:49 pm
by pbroste
Hello
@hbouma
To follow up on the progress, in my test environment we see that the 'phpmailer.php' (xi_service_notification_handler) definitely formats differently than what we see when we send out with
mailx using for example 'notify-host-by-email' or 'notify-service-by-email'.
I will continue to work on this and follow up with the results,
Perry
Re: Email of multiline output
Posted: Wed Dec 01, 2021 10:18 am
by hbouma
Thanks
Re: Email of multiline output
Posted: Thu Dec 02, 2021 10:47 am
by pbroste
Hello
@hbouma
I will be working on this throughout the day and will follow up shortly.
Thanks,
Perry
Re: Email of multiline output
Posted: Thu Dec 02, 2021 5:49 pm
by pbroste
Hello
@hbouma
To follow up, made the following updates to my test VM which results in a carriage return/linefeed on the $LONGSERVICEOUTPUT$ on 'check_files.ps'.
Verify config found under Admin > System Settings > General Tab > Allow HTML Rendering:
- Allow HTML tags in host/service statuses
- Allow HTML tags in host/service comments
Verify the second option found in the upper-right-hand corner select the current logged in user > Notification Methods >
deselect:
- Receive emails in plain text only
Here is the results that I am receiving from my test VM server:
files_modified.png
Let me know how things look on your end,
Perry
Re: Email of multiline output
Posted: Mon Dec 06, 2021 8:17 am
by hbouma
I think you found the issue. The "Allow HTML Tags in Host/Service Status" was not checked.
Thank you!!!!