Page 1 of 3

PDF Reports failing to generate

Posted: Sat Jun 13, 2015 7:11 pm
by derekb
It seems PDF Reports are failing to generate, and are producing the following error:

Code: Select all

************ ERROR: Failed to render URL 'http://mydomain.com/nagiosxi//reports/notifications.php?1&hideoptions=1&username=nagiosadmin&ticket=hhlrana6&locale=en_US&records=100000' as '/usr/local/nagiosxi/tmp/scheduledreport-nagiosadmin-1434239951-page.pdf' ************
I am able to generate reports as CSV with no issues. I've some some searches, and it seems other people have experienced this issue but have not posted the answer to the problem. Any assistance would be appreciated.

Re: PDF Reports failing to generate

Posted: Sun Jun 14, 2015 11:39 pm
by Box293
Run this command:

Code: Select all

tail -f /var/log/httpd/error_log
Then try and generate the PDF. Do any errors appear?

Do the same again with this command running:

Code: Select all

tail -f /usr/local/nagiosxi/var/cmdsubsys.log

Re: PDF Reports failing to generate

Posted: Mon Jun 15, 2015 9:46 am
by derekb
Hello Box,
While running those commands, I get no output when I attempt to generate a PDF report.

Any other ideas?

Re: PDF Reports failing to generate

Posted: Mon Jun 15, 2015 10:06 am
by ssax
What version of XI are you using?

Please post the output of the following commands:

Code: Select all

ls -ld /usr/local/nagiosxi
ls -ld /usr/local/nagiosxi/tmp
Also, what do you have set under Program URL and External URL in Admin > System Config > Manage System Config?

Re: PDF Reports failing to generate

Posted: Mon Jun 15, 2015 10:36 am
by derekb
ssax wrote:What version of XI are you using?

Please post the output of the following commands:

Code: Select all

ls -ld /usr/local/nagiosxi
ls -ld /usr/local/nagiosxi/tmp
Also, what do you have set under Program URL and External URL in Admin > System Config > Manage System Config?
Nagios XI 2014R2.7

[root@nagios nagiosxi]# ls -ld /usr/local/nagiosxi
drwxr-xr-x. 10 nagios nagios 4096 Jun 8 10:41 /usr/local/nagiosxi

[root@nagios nagiosxi]# ls -ld /usr/local/nagiosxi/tmp
drwsrwsr-x. 2 apache nagios 4096 Jun 13 20:13 /usr/local/nagiosxi/tmp

Program URL: http://nagios.mydomain.com/nagiosxi/
External URL: http://nagios.mydomain.com/nagiosxi/

Re: PDF Reports failing to generate

Posted: Mon Jun 15, 2015 11:07 am
by ssax
Is selinux enabled?

Code: Select all

sestatus

Re: PDF Reports failing to generate

Posted: Mon Jun 15, 2015 12:32 pm
by derekb
ssax wrote:Is selinux enabled?

Code: Select all

sestatus
SELinux status: disabled

Re: PDF Reports failing to generate

Posted: Mon Jun 15, 2015 1:47 pm
by ssax
Try running the command below and try it again:

Code: Select all

chown nagios.nagios /usr/local/nagiosxi/tmp

Re: PDF Reports failing to generate

Posted: Mon Jun 15, 2015 2:18 pm
by derekb
That did not work, sadly.

Re: PDF Reports failing to generate

Posted: Mon Jun 15, 2015 3:18 pm
by ssax
Edit:

Code: Select all

/usr/local/nagiosxi/html/reports/notifications.php
Add This:

Code: Select all

$file = '/tmp/notifications_pdf.sh';
// Write the contents back to the file
file_put_contents($file, $cmd);
Right before this code:

Code: Select all

if (!file_exists($fname)) {
        echo "\n\n************\nERROR: Failed to render URL '" . $aurl . "' as '" . $fname . "'\n************\n\n";
Then refresh the page and try to generate the PDF again.

Then right away run this command to see if it works for you:

Code: Select all

sh /tmp/notifications_pdf.sh
Let me know the results, if you get any errors, send me the full output.