PDF Report(s) Corrupt When Emailed

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
rj-admin2
Posts: 34
Joined: Thu Apr 11, 2024 1:16 am

PDF Report(s) Corrupt When Emailed

Post by rj-admin2 »

I have an issue in that when pdf format reports are emailed, they are corrupt and Adobe Viewer cannot open them. Running the reports manually and downloading them works fine. Its only when the reports are emailed the problem occurs.

After reading some other emailed reports issues, I can confirm I don't have a proxy set and my external URL is blank. Even if I make the external URL the same as the current internal one, the report s are still corrupt.

Anyone have any ideas?


TIA,
RobMcL
Posts: 9
Joined: Wed Jun 12, 2019 11:50 am

Re: PDF Report(s) Corrupt When Emailed

Post by RobMcL »

I also have this exact problem. The only thing different is I'm now on RHEL9. Last month I was on CentOS7 and my reports ran fine. Really would like to know a solution to this issue.
cnorell
Developer
Posts: 141
Joined: Mon Nov 27, 2017 3:08 pm

Re: PDF Report(s) Corrupt When Emailed

Post by cnorell »

rj-admin2,

What version of XI and operating system are you running?

RobMcl,

What version of XI are you running?

I'll see if I can replicate your issues on my end and have a poke around.

Best Regards,

Cory Norell
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
RobMcL
Posts: 9
Joined: Wed Jun 12, 2019 11:50 am

Re: PDF Report(s) Corrupt When Emailed

Post by RobMcL »

Hi Cory,

I'm using Nagios XI 2024R1.1.2.
RobMcL
Posts: 9
Joined: Wed Jun 12, 2019 11:50 am

Re: PDF Report(s) Corrupt When Emailed

Post by RobMcL »

One thing I do notice when I create a profile for a ticket I am opening because I can't upgrade to 2024R1.1.3 is this output:

./XI_DiagnosticProfile.sh: line 670: /usr/bin/wkhtmltopdf: No such file or directory

perhaps that is part of my issue with the PDFs? I tried to look into this and couldn't find a wkhtmltopdf package available for RHEL 9 so maybe that is helpful information to you.
ssunga
Posts: 72
Joined: Wed Aug 09, 2023 10:38 am

Re: PDF Report(s) Corrupt When Emailed

Post by ssunga »

That's helpful, @RobMcL

Does building from source work? This might be a good alternative especially if wkhtmltopdf (archived) doesn't have a RHEL 9 precompiled binary.

What I'd suggest to both of you is to see if you can build from source - there might be some dependency issues but it could be quick to resolve. I think these docs are probably the relevant ones:

https://github.com/aristsoft/wkhtmltopd ... INSTALL.md
RobMcL
Posts: 9
Joined: Wed Jun 12, 2019 11:50 am

Re: PDF Report(s) Corrupt When Emailed

Post by RobMcL »

hi @ssunga,

Thanks for the message - I don't think that link is accurate. The last change was 10 years ago and there is no longer a scripts folder on the git pull as suggested by your link (which would have only supported CentOS7).

add support for CentOS 7 target
0037e0e
·
10 years ago

And when I do a git pull, it doesn't have the same stuff in there. The README.md file states this:
wkhtmltopdf and wkhtmltoimage
-----------------------------

wkhtmltopdf and wkhtmltoimage are command line tools to render HTML into PDF
and various image formats using the QT Webkit rendering engine. These run
entirely "headless" and do not require a display or display service.

See https://wkhtmltopdf.org for updated documentation.

## Building
wkhtmltopdf has its own dedicated repository for building and packaging.

See https://github.com/wkhtmltopdf/packaging
And when I go to the dedicated repository, it wants me to package it as a docker. When I do a list-targets, it doesn't have RHEL anything and only has CentOS7. The closet to RHEL9 is almalinux9, but again, it's looking to do docker. Perhaps this method is obsolete now for Nagios and needs to be revisted?
sudo ./build list-targets
docker almalinux8-aarch64
docker almalinux8-ppc64le
docker almalinux8-x86_64
docker almalinux9-aarch64
docker almalinux9-ppc64le
docker almalinux9-x86_64
[...]
docker centos7-aarch64
docker centos7-i686
docker centos7-ppc64le
docker centos7-x86_64
[...]
swolf

Re: PDF Report(s) Corrupt When Emailed

Post by swolf »

Hi @RobMcL,

I wouldn't recommend building wkhtmltopdf or adding it to your XI server. We recently replaced the reporting backend for XI and don't rely on that program anymore.

@rj-admin2, I don't have a direct recommendation to resolve this, but do you see any warnings or errors in either /var/log/php-fpm/www-error.log or /usr/local/nagiosxi/var/chromium_report.log when the report is scheduled to run?

-Sebastian
ssunga
Posts: 72
Joined: Wed Aug 09, 2023 10:38 am

Re: PDF Report(s) Corrupt When Emailed

Post by ssunga »

I agree with @swolf,

Looking back, I made a bad call recommending trying to make wkhtmltopdf work especially if chromium is the new reporting backend.

The additional diagnostic info would be helpful here and maybe we can point you to a better solution.
RobMcL
Posts: 9
Joined: Wed Jun 12, 2019 11:50 am

Re: PDF Report(s) Corrupt When Emailed

Post by RobMcL »

@swolf,

I know you asked rj-admin2 about the logs, but just to be complete, my chromium_report.log shows nothing when I run the report, but this is what my www-error.log shows:

[05-Jun-2024 12:15:52] WARNING: [pool www] child 1184174 said into stderr: "--2024-06-05 12:15:52-- https://nagios.REDACTED.com/nagiosxi//r ... 89238fbc42"
[05-Jun-2024 12:15:52] WARNING: [pool www] child 1184174 said into stderr: "Resolving nagios.REDACTED.com (nagios.REDACTED.com)... IP-REDACTED"
[05-Jun-2024 12:15:52] WARNING: [pool www] child 1184174 said into stderr: "Connecting to nagios.REDACTED.com (nagios.REDACTED.com)|IP-REDACTED|:443... connected."
[05-Jun-2024 12:15:52] WARNING: [pool www] child 1184174 said into stderr: "HTTP request sent, awaiting response... 302 Found"
[05-Jun-2024 12:15:52] WARNING: [pool www] child 1184174 said into stderr: "Location: https://nagios.REDACTED.com/nagiosxi/lo ... 2&noauth=1 [following]"
[05-Jun-2024 12:15:52] WARNING: [pool www] child 1184174 said into stderr: "--2024-06-05 12:15:52-- https://nagios.REDACTED.com/nagiosxi/lo ... 2&noauth=1"
[05-Jun-2024 12:15:52] WARNING: [pool www] child 1184174 said into stderr: "Reusing existing connection to nagios.REDACTED.com:443."
[05-Jun-2024 12:15:52] WARNING: [pool www] child 1184174 said into stderr: "HTTP request sent, awaiting response... 200 OK"
[05-Jun-2024 12:15:52] WARNING: [pool www] child 1184174 said into stderr: "Length: unspecified [text/html]"
[05-Jun-2024 12:15:52] WARNING: [pool www] child 1184174 said into stderr: "Saving to: '/usr/local/nagiosxi/tmp/scheduledreport-RobMcL-EUlPLCDn75l4-1717604152-TopAlertProducers.pdf'"
[05-Jun-2024 12:15:52] WARNING: [pool www] child 1184174 said into stderr: " 0K .......... .......... .......... .. 8.50M=0.004s"
[05-Jun-2024 12:15:52] WARNING: [pool www] child 1184174 said into stderr: "2024-06-05 12:15:52 (8.50 MB/s) - '/usr/local/nagiosxi/tmp/scheduledreport-RobMcL-EUlPLCDn75l4-1717604152-TopAlertProducers.pdf' saved [33145]"

The email comes through, 33KB in size and when I try to open it, I receive this:
We can't open this file
Something went wrong.
Post Reply