Page 1 of 1
Scheduled PDF report attachements corrupted
Posted: Thu Apr 24, 2014 9:27 pm
by Fred Kroeger
Hi
Scheduled reports that are attached as PDF files to emails report as being corrupted when I try to view them.
Looking at the files they are only 200-300 bytes.
I've also tried other reports and they all are attached as 200-300 byte files.
I've checked through the forum here and tried all the suggestions
Code: Select all
php.ini - display_errors=off
/usr/bin/wkhtmltopdf -V
Name:
wkhtmltopdf 0.10.0 rc2
Checked the error log and no errors are generated duringthe scheduled report period. However there are some errors logged when the availaibility report is run from the gui
Code: Select all
[Fri Apr 25 10:14:13 2014] [error] [client 203.25.253.2] PHP Notice: Undefined variable: data in /usr/local/nagiosxi/html/reports/availability.php on line 98, referer: http://per-p-nag01/nagiosxi/reports/availability.php?&=
[Fri Apr 25 10:14:13 2014] [error] [client 203.25.253.2] PHP Warning: Invalid argument supplied for foreach() in /usr/local/nagiosxi/html/reports/availability.php on line 98, referer: http://per-p-nag01/nagiosxi/reports/availability.php?&=
[Fri Apr 25 10:14:13 2014] [error] [client 203.25.253.2] PHP Notice: Undefined variable: xdata in /usr/local/nagiosxi/html/reports/availability.php on line 111, referer: http://per-p-nag01/nagiosxi/reports/availability.php?&=
[Fri Apr 25 10:14:13 2014] [error] [client 203.25.253.2] PHP Notice: Undefined variable: data in /usr/local/nagiosxi/html/reports/availability.php on line 98, referer: http://per-p-nag01/nagiosxi/reports/availability.php?&=
[Fri Apr 25 10:14:13 2014] [error] [client 203.25.253.2] PHP Warning: Invalid argument supplied for foreach() in /usr/local/nagiosxi/html/reports/availability.php on line 98, referer: http://per-p-nag01/nagiosxi/reports/availability.php?&=
[Fri Apr 25 10:14:13 2014] [error] [client 203.25.253.2] PHP Notice: Undefined variable: xdata in /usr/local/nagiosxi/html/reports/availability.php on line 111, referer: http://per-p-nag01/nagiosxi/reports/availability.php?&=
We're running NagiosXI 2012 R2.9
regards... Fred
Re: Scheduled PDF report attachements corrupted
Posted: Fri Apr 25, 2014 11:07 am
by lmiltchev
Can you still view/download as pdf the Availability reports properly (Reports->Download As PDF)? Are you having issues with other type of reports as well? What do you have in the "Program/External URL" fields under "System Settings" (Admin->Manage System Config)? Are you using a proxy or SSL?
Re: Scheduled PDF report attachements corrupted
Posted: Sun Apr 27, 2014 7:18 pm
by Fred Kroeger
Hi
Yes I can View/Download PDF reports OK.
As mentioned, I am also having this issue with other reports that are emailed.
Program URL :
http://hostname/nagiosxi/
External URL: BLANK
Proxy ? Yes a proxy IP address is defined and uses port 8080 (No auth required)
SSL? Not using SSL
Regards... Fred
Re: Scheduled PDF report attachements corrupted
Posted: Mon Apr 28, 2014 10:32 am
by slansing
Did you make the correct provisions for your proxy?
http://support.nagios.com/wiki/index.ph ... th_Proxies
Wget is used to pull down the pdf before it is emailed. After making those changes are you still having the same issue? If so what is the output of:
Re: Scheduled PDF report attachements corrupted
Posted: Mon Apr 28, 2014 7:18 pm
by Fred Kroeger
Hi
Yes I believe all my proxy settings are correct. They do work OK when I run Nagios Updates or install packages.
Code: Select all
yum.conf
proxy=http://10.29.253.2:8080/
Code: Select all
wgetrc
https_proxy=http://10.29.253.2:8080/
http_proxy=http://10.29.253.2:8080/
ftp_proxy=http://10.29.253.2:8080/
# Hosts to exclude from proxying
no_proxy=localhost,127.0.0.0/8,10.29.90.0/24
(the IP of the Nagios server is 10.29.90.X)
The version of wkhtmltopdf is still the same as listed above:
Code: Select all
[root@per-p-nag01 Storage]# /usr/bin/wkhtmltopdf -V
Name:
wkhtmltopdf 0.10.0 rc2
It appears that only the PDF files are corrupted. If I also email the CSV files, they are readable. However the contents are not what I'm expecting, It has XML data instead of CSV,
Here is a sample of the HostData CSV file from the Availability Report
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--//////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 1996 - 2011
// See WebsenseCopyright.txt for copyright information
//
///////////////////////////////////////////////////////////////////////////-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Access to this site is blocked</title>
<link rel="stylesheet" href="/en/Default/master.css" type="text/css">
<script type="text/javascript" language="javascript" src="/en/Default/master.js"></script>
<script type="text/javascript" language="javascript" src="/en/Default/base64.js"></script>
<script type="text/javascript" language="javascript" src="/en/Default/security.js"></script>
</head>
<body>
<!--[if lt IE 7]> <div style="width: 725px;"> <![endif]-->
<div style="border: 1px solid #285EA6;width: 95%; max-width: 700px; overflow: hidden; margin-left: 10px; background-color: #EEF2F7;">
" <iframe src=""http://X.X.X.X:15871/cgi-bin/block_message.cgi?ws-session=1157723348"" title=""test"" name=""ws_block"" frameborder=""0"" scrolling=""auto"" style=""width:100%; height: 10em;"">"
" </iframe>"
" <iframe src=""http://X.X.X.X:15871/cgi-bin/blockOptions.cgi?ws-session=1157723348"" name=""ws_blockoption"" frameborder=""0"" scrolling=""auto"" style=""width:100%; height: 17.5em;"">"
" <p>To enable further options"
" </iframe>"
" <div><img title=""XX Limited"" src=""/en/Custom/logo.gif"" alt=""XX Logo"" style=""float: right;clear: both;margin: 0px 10px 6px 0px; padding: 2px 0px;"">"
" <div style=""clear: both; overflow: hidden; height:1px;""></div>"
" </div>"
</div>
<!--[if lt IE 7]> </div> <![endif]-->
<div id="light" class="white_content"></div>
<div id="fade" class="black_overlay"></div>
</body>
</html>
Re: Scheduled PDF report attachements corrupted
Posted: Mon Apr 28, 2014 9:47 pm
by Fred Kroeger
Further to this probllem... It's looking very much that this is related to the Proxy config.
I saved the pdf file attached to the email and renamed it to a txt file so that I could read it.
It is an HTML file like the CSV files checked previously and it also has the same title...
<title>Access to this site is blocked</title>
Now the IP address listed is one of the proxy servers, so it appears that my Proxy bypass is not being honoured in wgetrc?
# Hosts to exclude from proxying
no_proxy=localhost,127.0.0.0/8,10.29.90.0/24
Can you confirm if I should have any other address listed on the no_proxy line?
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--//////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 1996 - 2011, Websense, Inc. All Rights Reserved
// See WebsenseCopyright.txt for copyright information
//
///////////////////////////////////////////////////////////////////////////-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Access to this site is blocked</title>
<link rel="stylesheet" href="/en/Default/master.css" type="text/css">
<script type="text/javascript" language="javascript" src="/en/Default/master.js"></script>
<script type="text/javascript" language="javascript" src="/en/Default/base64.js"></script>
<script type="text/javascript" language="javascript" src="/en/Default/security.js"></script>
</head>
<body>
<!--[if lt IE 7]> <div style="width: 725px;"> <![endif]-->
<div style="border: 1px solid #285EA6;width: 95%; max-width: 700px; overflow: hidden; margin-left: 10px; background-color: #EEF2F7;">
<iframe src="http://10.29.96.31:15871/cgi-bin/block_message.cgi?ws-session=2902569111" title="test" name="ws_block" frameborder="0" scrolling="auto" style="width:100%; height: 10em;">
</iframe>
<iframe src="http://10.29.96.31:15871/cgi-bin/blockOptions.cgi?ws-session=2902569111" name="ws_blockoption" frameborder="0" scrolling="auto" style="width:100%; height: 17.5em;">
<p>To enable further options, view this page with a browser that supports iframes</p>
</iframe>
<div><img title="XXLimited" src="/en/Custom/logo.gif" alt="XX Logo" style="float: right;clear: both;margin: 0px 10px 6px 0px; padding: 2px 0px;">
<div style="clear: both; overflow: hidden; height:1px;"></div>
</div>
</div>
<!--[if lt IE 7]> </div> <![endif]-->
<div id="light" class="white_content"></div>
<div id="fade" class="black_overlay"></div>
</body>
</html>
Re: Scheduled PDF report attachements corrupted
Posted: Mon Apr 28, 2014 11:22 pm
by Fred Kroeger
Update - got it working - but we've either got a problem with how wget interpets the wgetrc file or we need to update the FAQ.
The version of wget I'm running is: wget.x86_64 1.12-1.8.el6
It was resolved by actually adding the hostname to the no_proxy line in wgetrc.
It appears that whatever you use as the Nagios Program URL, you need to use the same string in the wgetrc file.
So if your URL =
http://ServerA/nagiosxi then the line in wgetrc should be:
no_proxy=localhost,127.0.0.0/8,ServerA
Or if you use an IP instead - URL =
http://10.1.1.10/nagiosxi then the line in wgetrc should be:
no_proxy=localhost,127.0.0.0/8,10.1.1.10
I also found that I can't use the subnet mask so the following doesn't work:
no_proxy=localhost,127.0.0.0/8,10.1.1.0/24
Thanks for pointing me in the right direction.
regards... Fred
Re: Scheduled PDF report attachements corrupted
Posted: Tue Apr 29, 2014 9:40 am
by slansing
Well if you are using DNS directly you would indeed need to use that host name. We could add that into the FAQ, the exact address needs to be what your proxy see's when it is sending and receiving from that address.