Scheduled Availability Report generates corrupt PDF files

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
DennisPR
Posts: 149
Joined: Mon May 07, 2012 10:34 am

Scheduled Availability Report generates corrupt PDF files

Post by DennisPR »

Hi,

I'm having trouble with all Availability Reports on my Nagios XI 5.5.8.
The generated PDF files are all 349 bytes and unreadable.
When I run the same report manually it generates the PDF ok.

This is the output from the command tail -f /var/log/httpd/error_log

Code: Select all

PHP Warning:  Invalid argument supplied for foreach() in /usr/local/nagiosxi/html/includes/components/nagiosim/nagiosim.inc.php on line 491
--2019-01-08 11:35:31--  http://ap-dco67-mon.bel.centric.lan/nagiosxi//reports/availability.php?reportperiod=lastmonth&startdate=&enddate=&host=&service=&hostgroup=frbe-all&servicegroup=&advanced=0&assumeinitialstates=yes&assumestateretention=yes&assumestatesduringdowntime=yes&includesoftstates=no&assumedhoststate=3&assumedservicestate=6&timeperiod=&locale=en&mode=pdf&token=d2bab6cc1f61c577f07da6101f7852f2523edabc
Resolving ap-dco67-mon.bel.centric.lan... 10.75.1.21
Connecting to ap-dco67-mon.bel.centric.lan|10.75.1.21|:80... connected.
HTTP request sent, awaiting response... Loading pages (1/6)
PHP Warning:  Module 'PDO' already loaded in Unknown on line 0 37%
PHP Warning:  Module 'pdo_mysql' already loaded in Unknown on line 0
No entry for terminal type "unknown";
using dumb terminal settings.
PHP Warning:  Invalid argument supplied for foreach() in /usr/local/nagiosxi/html/includes/components/nagiosim/nagiosim.inc.php on line 491
[Tue Jan 08 11:49:02 2019] [error] [client 10.70.1.50] PHP Warning:  Division by zero in /usr/local/nagiosxi/html/includes/components/opscreen/merlin.php on line 156, referer: http://ap-dco67-mon/nagiosxi/includes/components/opscreen/opscreen.php
[Tue Jan 08 11:49:02 2019] [error] [client 10.70.1.50] PHP Warning:  Division by zero in /usr/local/nagiosxi/html/includes/components/opscreen/merlin.php on line 158, referer: http://ap-dco67-mon/nagiosxi/includes/components/opscreen/opscreen.php
[Tue Jan 08 11:49:02 2019] [error] [client 10.70.1.50] PHP Warning:  Division by zero in /usr/local/nagiosxi/html/includes/components/opscreen/merlin.php on line 204, referer: http://ap-dco67-mon/nagiosxi/includes/components/opscreen/opscreen.php
[Tue Jan 08 11:49:02 2019] [error] [client 10.70.1.50] PHP Warning:  Division by zero in /usr/local/nagiosxi/html/includes/components/opscreen/merlin.php on line 206, referer: http://ap-dco67-mon/nagiosxi/includes/components/opscreen/opscreen.php
[Tue Jan 08 11:49:03 2019] [error] [client 10.70.1.44] PHP Warning:  Division by zero in /usr/local/nagiosxi/html/includes/components/opscreen/merlin.php on line 156, referer: http://ap-dco67-mon.bel.centric.lan/nagiosxi/includes/components/opscreen/opscreen.php
[Tue Jan 08 11:49:03 2019] [error] [client 10.70.1.44] PHP Warning:  Division by zero in /usr/local/nagiosxi/html/includes/components/opscreen/merlin.php on line 158, referer: http://ap-dco67-mon.bel.centric.lan/nagiosxi/includes/components/opscreen/opscreen.php
[Tue Jan 08 11:49:03 2019] [error] [client 10.70.1.44] PHP Warning:  Division by zero in /usr/local/nagiosxi/html/includes/components/opscreen/merlin.php on line 204, referer: http://ap-dco67-mon.bel.centric.lan/nagiosxi/includes/components/opscreen/opscreen.php
[Tue Jan 08 11:49:03 2019] [error] [client 10.70.1.44] PHP Warning:  Division by zero in /usr/local/nagiosxi/html/includes/components/opscreen/merlin.php on line 206, referer: http://ap-dco67-mon.bel.centric.lan/nagiosxi/includes/components/opscreen/opscreen.php
[Tue Jan 08 11:49:09 2019] [error] [client 10.70.1.27] PHP Warning:  Division by zero in /usr/local/nagiosxi/html/includes/components/opscreen/merlin.php on line 204, referer: http://ap-dco67-mon.bel.centric.lan/nagiosxi/includes/components/opscreen/opscreen.php
[Tue Jan 08 11:49:09 2019] [error] [client 10.70.1.27] PHP Warning:  Division by zero in /usr/local/nagiosxi/html/includes/components/opscreen/merlin.php on line 206, referer: http://ap-dco67-mon.bel.centric.lan/nagiosxi/includes/components/opscreen/opscreen.php
Read error (Connection timed out) in headers.
Retrying.

--2019-01-08 11:50:32--  (try: 2)  http://ap-dco67-mon.bel.centric.lan/nagiosxi//reports/availability.php?reportperiod=lastmonth&startdate=&enddate=&host=&service=&hostgroup=frbe-all&servicegroup=&advanced=0&assumeinitialstates=yes&assumestateretention=yes&assumestatesduringdowntime=yes&includesoftstates=no&assumedhoststate=3&assumedservicestate=6&timeperiod=&locale=en&mode=pdf&token=d2bab6cc1f61c577f07da6101f7852f2523edabc
Connecting to ap-dco67-mon.bel.centric.lan|10.75.1.21|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 27 [text/html]
Saving to: "/usr/local/nagiosxi/tmp/scheduledreport-dpeere-bs60kb-Availability_Report.pdf"

     0K                                                       100% 4.59M=0s

2019-01-08 11:50:32 (4.59 MB/s) - "/usr/local/nagiosxi/tmp/scheduledreport-dpeere-bs60kb-Availability_Report.pdf" saved [27/27]

Counting pages (2/6)
Resolving links (4/6)
Loading headers and footers (5/6)
Printing pages (6/6)
Done

User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Scheduled Availability Report generates corrupt PDF file

Post by cdienger »

What version of XI is this?

I assume you've seen https://support.nagios.com/kb/article.php?id=611 and increased the php.ini settings per https://support.nagios.com/kb/article.php?id=611. Is this correct?

Do you see anything being logged to /usr/local/nagiosxi/var/wkhtmltox.log when it fails?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
DennisPR
Posts: 149
Joined: Mon May 07, 2012 10:34 am

Re: Scheduled Availability Report generates corrupt PDF file

Post by DennisPR »

Hi

I'm running Nagios XI 5.5.8.
Here are some important settings of my php.ini

Code: Select all

max_execution_time = 180
max_input_time = 240
memory_limit = 1024M
max_input_vars = 5000
There is no /usr/local/nagiosxi/var/wkhtmltox.log
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Scheduled Availability Report generates corrupt PDF file

Post by npolovenko »

@DennisPR, Please run the following script as root and let me know if it resolves the issue:
cd /usr/local/nagiosxi/scripts/
./repair_databases.sh
Can you also upload the following file in the ticket?
/usr/local/nagiosxi/html/config.inc.php
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
DennisPR
Posts: 149
Joined: Mon May 07, 2012 10:34 am

Re: Scheduled Availability Report generates corrupt PDF file

Post by DennisPR »

Running the repair databases script didn't solve the problem
You do not have the required permissions to view the files attached to this post.
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Scheduled Availability Report generates corrupt PDF file

Post by npolovenko »

@DennisPR, Please open the config.inc.php file and replace the following block at the end:
///////// keep these in order /////////

// include generic db defs
if (!defined('CFG_ONLY')) { if (!defined('CFG_ONLY')) { require_once(dirname(__FILE__).'/includes/db.inc.php'); } }

// include generic definitions
if (!defined('CFG_ONLY')) { if (!defined('CFG_ONLY')) { require_once(dirname(__FILE__).'/db/common.inc.php'); } }
// include db-specific definitions
//if (!defined('CFG_ONLY')) { if (!defined('CFG_ONLY')) { require_once(dirname(__FILE__).'/db/'.$cfg['dbtype'].'.inc.php'); } }

?>
With:
///////// keep these in order /////////

if (!defined('CFG_ONLY')) {

// include generic db defs
require_once(dirname(__FILE__) . '/includes/db.inc.php');

// include generic definitions
require_once(dirname(__FILE__) . '/db/common.inc.php');

}
Do not add anything else, including "?>".

Save the file and let me know if this fixes the issue.

Run:
service httpd restart
If the pdf file comes corrupted again please upload it in the thread.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
DennisPR
Posts: 149
Joined: Mon May 07, 2012 10:34 am

Re: Scheduled Availability Report generates corrupt PDF file

Post by DennisPR »

Hi that didn't solve the problem see attachment.
You do not have the required permissions to view the files attached to this post.
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Scheduled Availability Report generates corrupt PDF file

Post by npolovenko »

@DennisPR, Please update to XI 5.5.9. Then go to the Admin menu and click on System Settings in the left column. Make sure the timezone is accurate. Have you changed the timezone on this server recently?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
DennisPR
Posts: 149
Joined: Mon May 07, 2012 10:34 am

Re: Scheduled Availability Report generates corrupt PDF file

Post by DennisPR »

Upgrading to 5.5.9 didn't solve the problem as well.
The Timezone is set to (UTC+ 01:00) Brussels like it should be in the system settings of Nagios.
I don't know if someone ever changed the timezone manually on this server that has been running for a couple of years.
Do you want me to check anything else ?
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Scheduled Availability Report generates corrupt PDF file

Post by ssax »

If you open up the PDF you attached with a text editor you will see this message:

Code: Select all

Your session has timed out.
It could be related to these messages:

Code: Select all

PHP Warning:  Module 'PDO' already loaded in Unknown on line 0 37%
PHP Warning:  Module 'pdo_mysql' already loaded in Unknown on line 0
Please attach your /etc/php.ini and the output of these commands:

Code: Select all

ls -l /etc/php.d
grep "PDO\|pdo_mysql" /etc/php.d/*
Additionally, please PM me a fresh copy of your profile, you can download it from Admin > System Profile > Download Profile so that I can review some settings.
Locked