Mailed report is blank but fine on screen

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Mailed report is blank but fine on screen

Post 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>
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
jomann
Development Lead
Posts: 611
Joined: Mon Apr 22, 2013 10:06 am
Location: Nagios Enterprises

Re: Mailed report is blank but fine on screen

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Mailed report is blank but fine on screen

Post 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]
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
jomann
Development Lead
Posts: 611
Joined: Mon Apr 22, 2013 10:06 am
Location: Nagios Enterprises

Re: Mailed report is blank but fine on screen

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Mailed report is blank but fine on screen

Post by eloyd »

Updated PHP code you PMed me fixes the problem. Haven't checked to see if it causes other problems. :-)
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Mailed report is blank but fine on screen

Post by tmcdonald »

We can keep this open if you'd like, otherwise I'd like to close it up.
Former Nagios employee
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Mailed report is blank but fine on screen

Post by eloyd »

I'm confident of the future of this problem. It can be closed. Thanks.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
Locked