Page 1 of 3

report rendering to pdf broken after upgrade

Posted: Tue Dec 02, 2014 5:35 am
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

Re: report rendering to pdf broken after upgrade

Posted: Tue Dec 02, 2014 11:26 am
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.

Re: report rendering to pdf broken after upgrade

Posted: Wed Dec 03, 2014 8:07 am
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.

Re: report rendering to pdf broken after upgrade

Posted: Wed Dec 03, 2014 10:08 am
by tmcdonald
Have you implemented SSL on this server?

Re: report rendering to pdf broken after upgrade

Posted: Thu Dec 04, 2014 6:02 am
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.

Re: report rendering to pdf broken after upgrade

Posted: Thu Dec 04, 2014 10:58 am
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

Re: report rendering to pdf broken after upgrade

Posted: Fri Dec 05, 2014 4:21 am
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.

Re: report rendering to pdf broken after upgrade

Posted: Fri Dec 05, 2014 9:50 am
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.

Re: report rendering to pdf broken after upgrade

Posted: Fri Dec 05, 2014 10:11 am
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

Re: report rendering to pdf broken after upgrade

Posted: Fri Dec 05, 2014 12:47 pm
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