Reports to PDF are empty

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
nveeder
Posts: 20
Joined: Fri Feb 01, 2013 2:54 pm

Reports to PDF are empty

Post by nveeder »

Nagios XI 2012R1.6
RHEL 5.8 x64

When I attempt to email or save an Executive Summary, Availability, or State History report the resulting PDF is the same unreadable 64B file. I saw another thread that recommended running nagiosxi/subcomponents/wkhtml/install from the last installation package. I edited that file to set the installpath, ran it as root, and did not receive any errors. Afterwards I still have the same result when generating a PDF.
nveeder
Posts: 20
Joined: Fri Feb 01, 2013 2:54 pm

Re: Reports to PDF are empty

Post by nveeder »

What logs or debugging should I use to troubleshoot?
When generating a PDF report, here is what the Apache log shows. The strftime and strtotime PHP Warnings fill this log and are not specific to reports.

Code: Select all

[Tue Mar 26 09:17:40 2013] [error] [client 127.0.0.1] PHP Warning:  strftime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for 'EDT/-4.0/DST' instead in /usr/local/nagiosxi/html/includes/utilsl.inc.php on line 387, referer: https://localhost/nagiosxi/reports/execsummary.php?1&hideoptions=1&username=nveeder&ticket=oljrmav3j4mlse7rc8ljhnvchihk0ghn32iobfquifjdqn87vsneklp378m6n5sp
[=================================================>          ] 83%^M[===================================================>        ] 85%^M[====================================================>       ] 88%^MWarning: SSL error ignored
Warning: SSL error ignored
[=====================================================>      ] 89%^M[=====================================================>      ] 89%^M[============================================================] 100%^MCounting pages (2/6)
[============================================================] Object 1 of 1^MResolving links (4/6)
[============================================================] Object 1 of 1^MLoading headers and footers (5/6)
Printing pages (6/6)
[>                                                           ] Preparing^M[============================================================] Page 1 of 1^MDone                                      
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Reports to PDF are empty

Post by scottwilkerson »

To begin with you should set your timezone in /etc/php.ini
Instructions are here

Also, lets verify display_errors are Off

Code: Select all

 cat /etc/php.ini |grep display_errors
Make sure to restart apache

Code: Select all

service httpd restart
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
nveeder
Posts: 20
Joined: Fri Feb 01, 2013 2:54 pm

Re: Reports to PDF are empty

Post by nveeder »

Thanks. php.ini now has the timezone set and display errors is off.
I replicated the issue by attempting to email an existing scheduled report and have the httpd log entries below. It looks like the localhost request fails because its not using the name in the SSL cert. Do I need to add the no check switch somewhere? Is the undefined variable error a concern?

Code: Select all

[Tue Mar 26 10:22:18 2013] [notice] Apache/2.2.3 (Red Hat) configured -- resuming normal operations
--2013-03-26 10:22:31--  https://localhost/nagiosxi/reports/execsummary.php?&reportperiod=lastweek&startdate=&enddate=&reporttimesubmitbutton=Go&host=&hostgroup=&servicegroup=&username=nveeder&ticket=oljrmav3j4mlse7rc8ljhnvchihk0ghn32iobfquifjdqn87vsneklp378m6n5sp&mode=pdf
Resolving localhost... 127.0.0.1
Connecting to localhost|127.0.0.1|:443... connected.
ERROR: certificate common name `nagiosxi.<domain removed>.com' doesn't match requested host name `localhost'.
To connect to localhost insecurely, use `--no-check-certificate'.
Unable to establish SSL connection.
[Tue Mar 26 10:22:31 2013] [error] [client 10.82.66.122] PHP Notice:  Undefined variable: cmd in /usr/local/nagiosxi/html/includes/components/scheduledreporting/schedulereport.php on line 202, referer: https://nagiosxi.<domain removed>.com/nagiosxi/includes/components/scheduledreporting/schedulereport.php?go=1&id=dl6bqj
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Reports to PDF are empty

Post by sreinhardt »

You could try modifying line 354 to add the --no-check-certificate before the first set of single quotes breaks. Otherwise I would really suggest modifying line 325 instead, to the hostname referenced in the certificate, nagiosxi.<redacted domain>.com.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
nveeder
Posts: 20
Joined: Fri Feb 01, 2013 2:54 pm

Re: Reports to PDF are empty

Post by nveeder »

OK, I will test those suggestions.
Am I the first person running Nagios XI over SSL to attempt to generate reports as PDF? Do PDF reports work for you when using from an SSL enabled site?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Reports to PDF are empty

Post by scottwilkerson »

Actually, the certificate error isn't the problem as it is being ignored by default wktohtml

I can make the report on my server just fine when connecting via SSL.

Do you get this also if you just click on the PDF icon?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
nveeder
Posts: 20
Joined: Fri Feb 01, 2013 2:54 pm

Re: Reports to PDF are empty

Post by nveeder »

I was able to save an executive summary and availability report using the PDF icon and open successfully. I clicked the email icon to send the availability report PDF, opened it on the same client, and Adobe Reader showed a message that it is not a supported file type or the file is damaged.
Apache's error log shows similar messages as above about a cert mismatch and then the PHP notice of an undefined variable: cmd coming from scheduledreport.php.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Reports to PDF are empty

Post by scottwilkerson »

I did indeed find a bug in the scheduled reporting and it will be fixed with the XI release 2012R1.7 (which is due out in the next several days).
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
nveeder
Posts: 20
Joined: Fri Feb 01, 2013 2:54 pm

Re: Reports to PDF are empty

Post by nveeder »

OK, thanks. I'll try again after the new release
Locked