report rendering to pdf broken after upgrade

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
cmerchant
Posts: 546
Joined: Wed Sep 24, 2014 11:19 am

Re: report rendering to pdf broken after upgrade

Post by cmerchant »

Here is a related post with the same problem, with a solution:

http://support.nagios.com/forum/viewtop ... 31#p111125
CBoekhuis
Posts: 234
Joined: Tue Aug 16, 2011 4:55 am

Re: report rendering to pdf broken after upgrade

Post by CBoekhuis »

Hi lmiltchev,

I uploaded a screenshot of the program URL.
Here is the output of the hostsfile:

Code: Select all

root:/var/log/httpd> cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6
192.168.16.62           nagiosxi.boekhuis.nl nagiosxi
Yes, we can schedule reports (new and existing) and run them fine. The only problem is that the attached pdf in the email is "broken". Actually it isn't a pdf at all, because if I edit it it's just a plain text file with the same error message that I also get in the browser when I click on the render to pdf button.

@cmerchant: I saw that post, but the wkhtmltopdf command exists on the system. Although I'm a bit curious as to the version, the current available version is 0.12.1 On the system we've got 0.10.0:

Code: Select all

root:/var/log/httpd> wkhtmltopdf -V
Name:
  wkhtmltopdf 0.10.0 rc2
Does nagiosxi require a specific minimum version? I also wonder if the render process uses certain libraries, etc. that may be outdated on our system?

Greetings,
Hans
You do not have the required permissions to view the files attached to this post.
CBoekhuis
Posts: 234
Joined: Tue Aug 16, 2011 4:55 am

Re: report rendering to pdf broken after upgrade

Post by CBoekhuis »

I just restored last months error_log files from the backup. The "PHP Notice: Undefined index: use_https" message was also there when the pdf's were correctly rendered.
So the PHP notices are unrelated to this problem.
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: report rendering to pdf broken after upgrade

Post by tgriep »

Hans,

For a test, I downgraded my copy of wkhtmltopdf to the same version you are running and the report did run for me on my XI 2.0 server.

Is there a chance you can post the full error message for the Failed to render URL with without editing it?

Thanks.
Be sure to check out our Knowledgebase for helpful articles and solutions!
CBoekhuis
Posts: 234
Joined: Tue Aug 16, 2011 4:55 am

Re: report rendering to pdf broken after upgrade

Post by CBoekhuis »

Thanks for trying the downgrade Tgriep, here's the full error:

************ ERROR: Failed to render URL 'http://nagiosxi.boekhuis.nl/nagiosxi//r ... rds=100000' as '/usr/local/nagiosxi/tmp/scheduledreport-bloha-1418115226-page.pdf' ************
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: report rendering to pdf broken after upgrade

Post by lmiltchev »

Change the "Program URL" to use "https" instead of "http".

Admin->Manage System Config->Program URL = https://nagiosxi.boekhuis.nl/nagiosxi/->Update Settings

Let me know if this fixed your issue.
Be sure to check out our Knowledgebase for helpful articles and solutions!
CBoekhuis
Posts: 234
Joined: Tue Aug 16, 2011 4:55 am

Re: report rendering to pdf broken after upgrade

Post by CBoekhuis »

I changed the program url, unfortunately no change:

************ ERROR: Failed to render URL 'https://nagiosxi.boekhuis.nl/nagiosxi// ... cale=en_US' as '/usr/local/nagiosxi/tmp/scheduledreport-bloha-1418197763-page.pdf' ************

I've decided to dig a little deeper today, from what I have read I assume the wkhtmltopdf is used to render the page to a pdf.

Code: Select all

nagios:/tmp> wkhtmltopdf "http://www.google.com" google.pdf
Loading pages (1/6)
Counting pages (2/6)                                               
Resolving links (4/6)                                                       
Loading headers and footers (5/6)                                           
Printing pages (6/6)
Done      
The rendered pdf looks great, so that works! Next try is replacing the google with the above URL in the error (not using https, I don't want to introduce to many changes):

Code: Select all

nagios:/tmp> wkhtmltopdf "http://nagiosxi.boekhuis.nl/nagiosxi//reports/availability.php?1&hideoptions=1&username=bloha&ticket=fle5r3fngabe6hsuv5aq5sau8j36qoq9d9d89psp3757o05l4fd69n5e85j2sc89&locale=en_US" nagiosxi.pdf
Loading pages (1/6)
wkhtmltopdf: symbol lookup error: wkhtmltopdf: undefined symbol: FcFreeTypeQueryFace
I also tried the above with the "--load-error-handling ignore" option, but it will still not get passed stage 1 "Loading pages".
I searched around and found a few references to the fontconfig-devel package. However, it appears there is no update available for what is installed (fontconfig-devel.i386 2.4.1-7.el5).

I wonder if there are any other packages that may be used in the render process (font libraries?)
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: report rendering to pdf broken after upgrade

Post by lmiltchev »

Can you try updating the wkhtmltopdf version? If you still have the original install directory, run:

Code: Select all

cd /tmp/nagiosxi/subcomponents/wkhtmlx
./install
Check to see if the wkhtmltopdf got updated:

Code: Select all

wkhtmltopdf -V
wkhtmltoimage -V
Did this fix your issue?
Be sure to check out our Knowledgebase for helpful articles and solutions!
CBoekhuis
Posts: 234
Joined: Tue Aug 16, 2011 4:55 am

Re: report rendering to pdf broken after upgrade

Post by CBoekhuis »

Thank you lmiltchev!!

the wkhtmltoimage command was missing.

Code: Select all

root:/var/log/httpd> which wkhtmltoimage 
/usr/bin/which: no wkhtmltoimage in (/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
I ran the installer as suggested:

Code: Select all

root:/usr/local/nagiosxi/tmp/nagiosxi/subcomponents/wkhtmlx> ./install
Installing wkhtmltopdf and wkhtmltoimage...
--2014-12-11 09:42:28--  http://assets.nagios.com/downloads/nagiosxi/components/wkhtmltox-0.12.1-centos5-i386.tar.gz
Resolving assets.nagios.com... 72.14.181.71
Connecting to assets.nagios.com|72.14.181.71|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 48037817 (46M) [application/x-gzip]
Saving to: `wkhtmltox-0.12.1-centos5-i386.tar.gz'

100%[======================================================================================================================>] 48,037,817  2.14M/s   in 25s     

2014-12-11 09:42:53 (1.85 MB/s) - `wkhtmltox-0.12.1-centos5-i386.tar.gz' saved [48037817/48037817]

wkhtmltox installed OK.
root:/usr/local/nagiosxi/tmp/nagiosxi/subcomponents/wkhtmlx> wkhtmltopdf -V
wkhtmltopdf 0.12.1-c22928d (with patched qt)
root:/usr/local/nagiosxi/tmp/nagiosxi/subcomponents/wkhtmlx> wkhtmltoimage -V
wkhtmltoimage 0.12.1-c22928d (with patched qt)
And the report is rendered to pdf without a problem. :D

I immediately noticed something else, if you take the alert histogram report as example, in the past the dotted line graph wasn't rendered to pdf correctly. A thick light grey line with the dots in the grey line. Earlier this year this graph was rendered as a really thick black line, and now the render process didn't work at all anymore.
Although there's a fresh install of the wkhtmlx provided in the installer, it apparently isn't installed during the upgrade process. I don't know if it is for a reason or maybe a glitch, but I thought I'd mentioned it.

Thanks for all the help, time to send out some reports!
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: report rendering to pdf broken after upgrade

Post by tmcdonald »

Can you attach an example screenshot or PDF that is displaying this behavior?
Former Nagios employee
Locked