Page 2 of 2

Re: Mailed report is blank but fine on screen

Posted: Fri May 04, 2018 4:00 pm
by eloyd
A quick look at our HTTP access log (posted in a previous note) shows it very clearly not using the full URL with port.

The contents of the file are essentially the empty HTML returned by our external URL capturing port 80 traffic and sending it somewhere else:

Code: Select all

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
</head>
<meta http-equiv="refresh" content="0; url='/'" />
<meta http-equiv="cache-control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="expires" content="0" />
<body bgcolor="#ffffff">
</body>
</html>

Re: Mailed report is blank but fine on screen

Posted: Fri May 04, 2018 4:52 pm
by jomann
In utils-reports-export.inc.php you could try to replace the get_internal_url() in line 89 with get_localhost_url() which is what we are using in XI 5.5 - this should have it try to get the URL based on localhost ... if there is an issue with the cert and whatnot it should not care and still export the report. You could also try get_base_url() if the localhost URL function does not work for you. Base URL should do the entire thing, hostname, https, port, etc based on the apache configuration.

Re: Mailed report is blank but fine on screen

Posted: Mon May 07, 2018 3:38 pm
by eloyd
So now I'm really confused. Line 89 is get_internal_url, which pulls the internal URL config from the database, which is http://192.168.1.12/nagiosxi/

But that's not the URL that's being hit as shown in the /var/log/httpd/error_log file. I'll see if I can highlight the stuff that's of interest, below. Note that the correct external URL, complete with port, is specified the first time when the actual error comes in (DOMDocument::loadHTML(): Unexpected end tag : p in Entity, line: 8208 in /usr/local/nagiosxi/html/includes/components/objconfig/objconfig.inc.php on line 198). But from then on it only shows that it's trying to connect to the external URL without the port.

So if it's using internal URL on line 89 of the PHP you mentioned, then it's somehow getting external URL when it makes the request.



[Sun May 06 14:10:00 2018] [error] [client 173.239.221.130] PHP Warning: DOMDocument::loadHTML(): Unexpected end tag : p in Entity, line: 8208 in /usr/local/nagiosxi/html/includes/components/objconfig/objconfig.inc.php on line 198, referer: http://EXTERNAL.EVERWATCH.GLOBAL:8675/nagiosxi/includes/components/xicore/status.php?show=services&servicegroup=SVGP+Peers&servicestatustypes=16
--2018-05-07 16:31:32-- http://EXTERNAL.EVERWATCH.GLOBAL/nagiosxi//reports/execsummary.php?reportperiod=last24hours&startdate=&enddate=&host=&service=&hostgroup=&servicegroup=&advanced=0&assumeinitialstates=yes&assumestateretention=yes&assumestatesduringdowntime=yes&includesoftstates=no&assumedhoststate=3&assumedservicestate=6&timeperiod=&username=nagiosadmin&ticket=jdr6imlt&locale=en_US&mode=pdf
Resolving EXTERNAL.EVERWATCH.GLOBAL... 72.45.161.114
Connecting to EXTERNAL.EVERWATCH.GLOBAL|72.45.161.114|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 350 [text/html]
Saving to: "/usr/local/nagiosxi/tmp/scheduledreport-nagiosadmin-eB7okT-execsummary.pdf"

0K 100% 31.0M=0s

2018-05-07 16:31:32 (31.0 MB/s) - "/usr/local/nagiosxi/tmp/scheduledreport-nagiosadmin-eB7okT-execsummary.pdf" saved [350/350]

Re: Mailed report is blank but fine on screen

Posted: Wed May 09, 2018 11:49 am
by jomann
This is being sent as a scheduled report, which it looks like uses a slightly different way to generate reports compared to the viewing of a report in the UI (in XI 5.4.x) and it actually uses get_external_url(), which means that it is not using the program url which it should be. Let me try replacing a function in the script for you to test since it's an encrypted file.

Re: Mailed report is blank but fine on screen

Posted: Thu May 10, 2018 11:11 am
by eloyd
Updated PHP code you PMed me fixes the problem. Haven't checked to see if it causes other problems. :-)

Re: Mailed report is blank but fine on screen

Posted: Fri May 11, 2018 9:52 am
by tmcdonald
We can keep this open if you'd like, otherwise I'd like to close it up.

Re: Mailed report is blank but fine on screen

Posted: Fri May 11, 2018 10:45 am
by eloyd
I'm confident of the future of this problem. It can be closed. Thanks.