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.
CBoekhuis
Posts: 234
Joined: Tue Aug 16, 2011 4:55 am

report rendering to pdf broken after upgrade

Post by CBoekhuis »

Hello,

After upgrading NagiosXI 2014R1.5 to 2014R2.0 we ran into a problem where we can no longer render reports to pdf. Scheduled reports ahve no attachements or broken pdf's attached.
If I hit the pdf button in a report the follwing error is thrown:

************ ERROR: Failed to render URL 'http://[removed]/nagiosxi//reports/availability.php?1&hideoptions=1&username=[removed]&ticket=fle5r3fngabe6hsuv5aq5sau8j36qoq9d9d89psp3757o05l4fd69n5e85j2sc89&locale=en_US' as '/usr/local/nagiosxi/tmp/scheduledreport-[removed]-1417514895-page.pdf' ************

I allready found a few similar posts so I checked the following:

Code: Select all

> ls -ld /usr/local/nagiosxi/tmp
drwsrwsr-x 3 nagios nagios 8192 Dec  1 15:16 /usr/local/nagiosxi/tmp
> ls -ld /usr/local/nagiosxi
drwxr-xr-x 10 nagios nagios 1024 Feb  4  2014 /usr/local/nagiosxi

Code: Select all

> /usr/bin/wkhtmltopdf -V
Name:
  wkhtmltopdf 0.10.0 rc2
Furthermore our installation runs on RHEL5.7 32b.
Also there's still plenty of memory available for the render process:

Code: Select all

> free
             total       used       free     shared    buffers     cached
Mem:       5187844    4157472    1030372          0     229880    2311484
-/+ buffers/cache:    1616108    3571736
Swap:      2097144        232    2096912
When the error occurs, there is also a PHP Notice in de /var/log/httpd/error_log which I never saw before (to my knowledge):

Code: Select all

[Tue Dec 02 11:08:15 2014] [error] [client XXX.XXX.XXX.XXX] PHP Notice:  Undefined index:  use_https in /usr/local/nagiosxi/html/reports/availability.php on line 2575, referer: http://[removed]/nagiosxi/reports/availability.php?&=
Kind Regards,
Hans Blom
cmerchant
Posts: 546
Joined: Wed Sep 24, 2014 11:19 am

Re: report rendering to pdf broken after upgrade

Post by cmerchant »

Is it possible that your IP address of your nagios server has changed? In XI --> Admin --> System Config --> Manage System Config, check what is in Program URL: and see that the Program URL: has the correct IP address or that the dns hostname URL resolves correctly.

We had successfully recreated the error by changing from a static to a dynamic ip address of our Nagios XI server through DHCP and we received the same error message.
CBoekhuis
Posts: 234
Joined: Tue Aug 16, 2011 4:55 am

Re: report rendering to pdf broken after upgrade

Post by CBoekhuis »

Nope, it has had the same static ip for years. I've also have checked the DNS but it all resolves correctly.
The external URL is blank, so that is not the issue either.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: report rendering to pdf broken after upgrade

Post by tmcdonald »

Have you implemented SSL on this server?
Former Nagios employee
CBoekhuis
Posts: 234
Joined: Tue Aug 16, 2011 4:55 am

Re: report rendering to pdf broken after upgrade

Post by CBoekhuis »

No, there is no SSL configuration done. The Program URL is also plain http:// configured.
In the mean time I also checked the "export to CSV" which work fine, so it's only the pdf conversion that's not working.
cmerchant
Posts: 546
Joined: Wed Sep 24, 2014 11:19 am

Re: report rendering to pdf broken after upgrade

Post by cmerchant »

It appears that the use_https config might be missing,

the /usr/local/nagiosxi/html/config.inc.php file should have

Code: Select all

// force http/https
$cfg['use_https'] = false; // determines whether cron jobs and other scripts will force the use of HTTPS instead of HTTP
and not be commented out.

could we check this file:

Code: Select all

cd /usr/local/nagiosxi/html/
grep use_https config.inc.php
CBoekhuis
Posts: 234
Joined: Tue Aug 16, 2011 4:55 am

Re: report rendering to pdf broken after upgrade

Post by CBoekhuis »

Ok, it appears the code isn't in there:

Code: Select all

root:/usr/local/nagiosxi/html> grep use_https config.inc.php
root:/usr/local/nagiosxi/html> 
root:/usr/local/nagiosxi/html> ll config.inc.php 
-rwxr-x--- 1 nagios nagios 7054 Nov 13 13:31 config.inc.php
I also checked the config.inc.php that came with the upgrade, which is this one if I'm correct:

Code: Select all

root:/usr/local/nagiosxi/tmp/nagiosxi/nagiosxi/basedir/html> ll config.inc.php 
-rwxrwxr-x 1 nagios nagios 7054 Nov 13 13:30 config.inc.php
They are both the same.
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 »

Could you add the following line in the /usr/local/nagiosxi/html/config.inc.php file?

Code: Select all

$cfg['use_https'] = false; // determines whether cron jobs and other scripts will force the use of HTTPS instead of HTTP
Also, could you check the Program URL setting in Xi and make sure it is correct?

You can do that by Clicking on Admin and then Manage System Config on the left hand side.

The Program URL has to match the URL you use to access NagiosXI in your browser.
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 »

Hello,

I added the line as mentioned. The error message when rendering to pdf is unfortunately still there. However the "PHP Notice: Undefined index: use_https" in de /var/log/httpd/error_log did not appear.

As for the Program URL, that has been checked and verified to be correct ;)

After the weekend I'm going to pull some more error_log files from the backup to make sure that the notices actually new. At this moment I see a lot more of these kinds of PHP notices, so I want to be sure what it looked like about a month ago or so.

Greetings
Hans
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 »

As for the Program URL, that has been checked and verified to be correct
Can you show us what you have in the "Program URL" field? Do you have "http" or "https", FQDN or IP? What happens if you create a new report - can you schedule it successfully? What is the output of the following command?

Code: Select all

cat /etc/hosts
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked