PDF Report Generation broken

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
GldRush98
Posts: 259
Joined: Wed May 25, 2011 10:51 am
Location: Springfield, IL
Contact:

PDF Report Generation broken

Post by GldRush98 »

Nagios XI 2014R1.3-REV2812
All system components up to date.

I can run reports through the web gui fine, but if I click the PDF button to generate a file, I am greeted with messages like:
************ ERROR: Failed to render URL 'https://[redacted]/nagiosxi//reports/execsummary.php?1&hideoptions=1&username=noverstreet&ticket=[valid ticket id]&locale=en_US' as '/usr/local/nagiosxi/tmp/scheduledreport-noverstreet-1407434133-page.pdf' ************
And possibly related, on the generated graphs/pie charts, if I click the "Download PNG Image" or "Download JPEG Image" or any of those links to try and download the generated image, it just does nothing.
Last edited by GldRush98 on Wed Aug 13, 2014 2:16 pm, edited 1 time in total.
Prod XI: Debian 12 - Nagios XI 2026R1.2
Dev XI: Debian 12 - Nagios XI 2026R1.2
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: PDF Report Generation broken

Post by lmiltchev »

Do you have a correct "Program URL" specified under the "System Settings" (Admin->Manage System Config)? Do you have "External URL" specified as well? If you do, what happens when you remove the "External URL"? Are you able to generate the report then?
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
GldRush98
Posts: 259
Joined: Wed May 25, 2011 10:51 am
Location: Springfield, IL
Contact:

Re: PDF Report Generation broken

Post by GldRush98 »

Yes, Program URL has the url we always access it through https://sub.domain.com/nagiosxi
and the External URL box is blank since we don't use a different external url.
Prod XI: Debian 12 - Nagios XI 2026R1.2
Dev XI: Debian 12 - Nagios XI 2026R1.2
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: PDF Report Generation broken

Post by lmiltchev »

Run the following commands and show us the output:

Code: Select all

cat /etc/hosts
ls -ld /usr/local/nagiosxi/tmp
ls -ld /usr/local/nagiosxi
/usr/bin/wkhtmltopdf -V
Also, run the following command and upload the report.txt file that was generated in /tmp.

Code: Select all

curl "https://[redacted]/nagiosxi//reports/execsummary.php?1&hideoptions=1&username=noverstreet&ticket=unuqm6kqibunluhmvetj282l0ibhokcnc8fvc3ptblitj3hggf0ik35jid480dsa&locale=en_US" > /tmp/report.txt
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
GldRush98
Posts: 259
Joined: Wed May 25, 2011 10:51 am
Location: Springfield, IL
Contact:

Re: PDF Report Generation broken

Post by GldRush98 »

lmiltchev wrote:Run the following commands and show us the output:

Code: Select all

cat /etc/hosts
ls -ld /usr/local/nagiosxi/tmp
ls -ld /usr/local/nagiosxi
/usr/bin/wkhtmltopdf -V
Also, run the following command and upload the report.txt file that was generated in /tmp.

Code: Select all

curl "https://[redacted]/nagiosxi//reports/execsummary.php?1&hideoptions=1&username=noverstreet&ticket=[valid ticket id]&locale=en_US" > /tmp/report.txt
Well, here's the likely problem:
[root@nagios ~]# /usr/bin/wkhtmltopdf -V
Segmentation fault
Not sure how to go about updating/fixing that...
Last edited by GldRush98 on Wed Aug 13, 2014 2:21 pm, edited 1 time in total.
Prod XI: Debian 12 - Nagios XI 2026R1.2
Dev XI: Debian 12 - Nagios XI 2026R1.2
User avatar
lgroschen
Posts: 384
Joined: Wed Nov 27, 2013 1:17 pm

Re: PDF Report Generation broken

Post by lgroschen »

Good morning GldRush98!

I think there is a chance that you don't have enough memory to run wkhtmltopdf since it's a fairly large program. Are you running this XI in a VM? If so how much memory is allocated to the VM? Upping the memory could be a good test to see if this is the problem.

Then try running:

Code: Select all

top
in the XI box command line and print out the entire output here in a code box.

Thanks!
/Luke
/Luke
User avatar
GldRush98
Posts: 259
Joined: Wed May 25, 2011 10:51 am
Location: Springfield, IL
Contact:

Re: PDF Report Generation broken

Post by GldRush98 »

Code: Select all

top - 13:12:28 up 58 days, 21:21,  1 user,  load average: 3.22, 2.93, 2.74
Tasks: 168 total,   2 running, 166 sleeping,   0 stopped,   0 zombie
Cpu(s): 12.1%us,  1.8%sy,  0.0%ni, 84.9%id,  1.0%wa,  0.0%hi,  0.2%si,  0.0%st
Mem:   2097152k total,  1715528k used,   381624k free,   113148k buffers
Swap:  4161528k total,   135148k used,  4026380k free,   555872k cached
Not a problem with the file itself?

Broken server:

Code: Select all

-rwxr-xr-x 1 root root     11M Jan 30  2011 wkhtmltopdf
There also doesn't seem to be a wkhtmltoimage file that I noticed on another server...
Prod XI: Debian 12 - Nagios XI 2026R1.2
Dev XI: Debian 12 - Nagios XI 2026R1.2
User avatar
GldRush98
Posts: 259
Joined: Wed May 25, 2011 10:51 am
Location: Springfield, IL
Contact:

Re: PDF Report Generation broken

Post by GldRush98 »

Well, this is interesting...

http://blog.behance.net/dev/wkhtmltopdf ... ault-mania
Simply put, Xen is a completely different type of Linux kernel that Rightscale ( our web based cloud computing management platform ) uses to deploy millions of cloud-servers onto the web. The creator of the wkhtmltoimage/PDF libraries currently does NOT support Xen ( and probably won’t ). As a result, the static binary files FAIL upon execution every single time. Currently the only solution, ironically, is to use the 32-bit versions of these tools. Hopefully this saves someone out there from spending a couple days trying to debug this issue!
It is indeed a Xen VM... It looks like I need to switch it to the 32 bit version?
Prod XI: Debian 12 - Nagios XI 2026R1.2
Dev XI: Debian 12 - Nagios XI 2026R1.2
User avatar
GldRush98
Posts: 259
Joined: Wed May 25, 2011 10:51 am
Location: Springfield, IL
Contact:

Re: PDF Report Generation broken

Post by GldRush98 »

Well, I got wkhtmltopdf working by installing the 32 bit version and needed libs:

Code: Select all

wget http://downloads.sourceforge.net/project/wkhtmltopdf/0.12.1/wkhtmltox-0.12.1_linux-centos5-i386.rpm
rpm -i wkhtmltox-0.12.1_linux-centos5-i386.rpm
vi /etc/yum.conf
Edit the yum.conf to remove the exclusion to *.i?86 files (you may want to add this bad in after you install the 32 bit libs needed to run this)
Then it looked like since I install the rpm it didn't install dependencies of course... so after some hunting and pecking I ended up with:

Code: Select all

yum install glibc.i686 libjpeg-6b-38.i386 libpng-1.2.10-17.el5_8.i386 libXrender-0.9.1-3.1.i386 fontconfig-2.4.1-7.el5.i386 libXext-1.0.1-2.1.i386 libstdc++.so.6 -y
And finally

Code: Select all

[root@nagios bin]# /usr/local/bin/wkhtmltopdf -V
wkhtmltopdf 0.12.1 (with patched qt)
Rename old file so it'll use the right one:

Code: Select all

mv wkhtmltopdf wkhtmltopdf_old
Still not working. Thought maybe there was a hard coded path in Nagios somewhere so in /usr/bin

Code: Select all

ln -s /usr/local/bin/wkhtmltopdf wkhtmltopdf
*Still not working*. (still getting "************ ERROR: Failed to render URL")

Argh, I've got to be close.
Prod XI: Debian 12 - Nagios XI 2026R1.2
Dev XI: Debian 12 - Nagios XI 2026R1.2
User avatar
lgroschen
Posts: 384
Joined: Wed Nov 27, 2013 1:17 pm

Re: PDF Report Generation broken

Post by lgroschen »

Yes! I did see that article about the lack of Xen support.

It is a hardcoded path, but it should be located in:

Code: Select all

/usr/bin/
not /usr/local/bin/

That's where you should also find the wkhtmltoimage file as well.

Try this and let me know what the full output is. It says 'Failed to render URL ' which means there is no URL that is being targeted or it would print which URL target had failed.
/Luke
Locked