Page 1 of 1

Unable to download PDF/PNG/JPG Reports

Posted: Tue Jun 27, 2017 9:19 am
by sarfarosh
Hi Team,
We are able to download CSV reports but unable to download the PDF/PNG/JPG Reports in Nagios XI. We are using the latest version Nagios XI 5.4.5. Please find below the config output that may help.
[root@Synoptics ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
103.230.84.24 Synoptics
173.194.72.27 alt1.aspmx.l.google.com
72.52.252.4 synoptics.co.in
195.245.230.51 cluster5.eu.messagelabs.com
121.240.7.3 hostmx03.logix.in mail

[root@Synoptics ~]# wkhtmltopdf -V
wkhtmltopdf 0.12.1-c22928d (with patched qt)
[root@Synoptics ~]# wkhtmltoimage -V
wkhtmltoimage 0.12.1-c22928d (with patched qt)

[root@Synoptics ~]# ls -ld /usr/local/nagiosxi/tmp/
drwsrwsr-x. 2 nagios nagios 262144 Jun 27 19:22 /usr/local/nagiosxi/tmp/

[root@Synoptics ~]# tailf /var/log/httpd/error_log
[Tue Jun 27 19:45:50 2017] [notice] caught SIGTERM, shutting down
[Tue Jun 27 19:45:50 2017] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Tue Jun 27 19:45:50 2017] [notice] Digest: generating secret for digest authentication ...
[Tue Jun 27 19:45:50 2017] [notice] Digest: done
[Tue Jun 27 19:45:50 2017] [notice] Apache/2.2.15 (Unix) DAV/2 PHP/5.3.3 mod_ssl/2.2.15 OpenSSL/1.0.1e-fips configured -- resuming normal operations
[Tue Jun 27 19:45:52 2017] [notice] caught SIGTERM, shutting down
[Tue Jun 27 19:45:52 2017] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Tue Jun 27 19:45:52 2017] [notice] Digest: generating secret for digest authentication ...
[Tue Jun 27 19:45:52 2017] [notice] Digest: done
[Tue Jun 27 19:45:52 2017] [notice] Apache/2.2.15 (Unix) DAV/2 PHP/5.3.3 mod_ssl/2.2.15 OpenSSL/1.0.1e-fips configured -- resuming normal operations

Re: Unable to download PDF/PNG/JPG Reports

Posted: Tue Jun 27, 2017 10:25 am
by tgriep
It could that when the report is getting generated, it is hitting a PHP memory limit or a timeout limit.
You can verify this if you check the Apache Error log files in the /var/log/httpd folder while you recreate the error.

Try this change to the server and see if the reports are generated afterwards.
Edit your /etc/php.ini and set the following

Code: Select all

max_execution_time = 60     ; Maximum execution time of each script, in  seconds
max_input_time = 120     ; Maximum amount of time each script may spend parsing request data
memory_limit = 1G      ; Maximum amount of memory a script may consume
If they have been increased already, increase them further.
Save the file and restart the Apache daemon by running

Code: Select all

service httpd restart
Then test to see if the report can be generated after the change.

Re: Unable to download PDF/PNG/JPG Reports

Posted: Wed Jun 28, 2017 2:58 am
by sarfarosh
Hi tgriep,
Increased the following parameters in /etc/php.ini but still not able to download PDF/PNG report and getting same error.
max_execution_time = 500
max_input_time = 500
memory_limit = 2G

Re: Unable to download PDF/PNG/JPG Reports

Posted: Wed Jun 28, 2017 10:03 am
by tgriep
Login as root on the Nagios server and run the following command

Code: Select all

tail -f /var/log/httpd/*_log
Then login to the XI GUI and try and generate the report.
If it errors out, post the output from the tail command in the root shell.

Re: Unable to download PDF/PNG/JPG Reports

Posted: Thu Jun 29, 2017 8:19 am
by sarfarosh
Hi tgriep,
No errors are generating while downloading PDF. Please help.

Re: Unable to download PDF/PNG/JPG Reports

Posted: Thu Jun 29, 2017 10:15 am
by tgriep
Is the server setup for SSL access?

One thing to try is to go to the Admin > System Settings menu and fill in the External URL with the same URL as the Program URL and see if the reports can be downloaded as a PDF file.

If that fails, can you run the following as root on the nagios server and post the output?

Code: Select all

which wkhtmltopdf
ls -la /usr/local/nagiosxi/tmp
grep use_https /usr/local/nagiosxi/html/config.inc.php
uname -a
cat /etc/*release*

Re: Unable to download PDF/PNG/JPG Reports

Posted: Fri Jun 30, 2017 1:18 am
by sarfarosh
Hi tgriep,
After adding the external url its giving same error. Please find below the commands output:
[root@Synoptics ~]# which wkhtmltopdf
/usr/bin/wkhtmltopdf
[root@Synoptics ~]# wkhtmltopdf -V
wkhtmltopdf 0.12.1-c22928d (with patched qt)
[root@Synoptics ~]# ls -la /usr/local/nagiosxi/tmp
total 308
drwsrwsr-x. 2 nagios nagios 262144 Jun 29 15:35 .
drwxr-xr-x. 10 nagios nagios 4096 Dec 17 2015 ..
-rw-r--r-- 1 apache nagios 40118 Jun 29 15:35 mrtg-59.90.123.63
-rw-r--r-- 1 apache nagios 0 Jun 29 15:35 mrtg-59.90.123.63.done
-rw-r--r-- 1 apache nagios 564 Jun 29 15:16 mrtg-sairamkandivali.dyndns.org
-rw-r--r-- 1 apache nagios 0 Jun 29 15:16 mrtg-sairamkandivali.dyndns.org.done
[root@Synoptics ~]# grep use_https /usr/local/nagiosxi/html/config.inc.php
$cfg['use_https']=false; // determines whether cron jobs and other scripts will force the use of HTTPS instead of HTTP
[root@Synoptics ~]# uname -a
Linux Synoptics 2.6.32-573.22.1.el6.x86_64 #1 SMP Wed Mar 23 03:35:39 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
[root@Synoptics ~]# cat /etc/*release*
CentOS release 6.7 (Final)
CentOS release 6.7 (Final)
CentOS release 6.7 (Final)
cpe:/o:centos:linux:6:GA

Re: Unable to download PDF/PNG/JPG Reports

Posted: Fri Jun 30, 2017 9:34 am
by lmiltchev
Remove the external URL as it's the same as the program URL, and it is not going to help to have it in there. Do you have more than one NIC on this system? What is the output of the following commands?

Code: Select all

ip addr
host 103.230.84.24
What happens if you remove this line:

Code: Select all

103.230.84.24 Synoptics
from /etc/hosts, and restart apache? Can you run a report?

Re: Unable to download PDF/PNG/JPG Reports

Posted: Mon Jul 03, 2017 8:25 am
by sarfarosh
Hi Imiltchev,
FYI,
[root@Synoptics tmp]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:1d:d8:b7:21:8b brd ff:ff:ff:ff:ff:ff
inet 10.245.44.98/28 brd 10.245.44.111 scope global eth1
inet6 fe80::21d:d8ff:feb7:218b/64 scope link
valid_lft forever preferred_lft forever
3: eth4: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
link/ether 00:15:5d:64:0c:61 brd ff:ff:ff:ff:ff:ff
4: eth5: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
link/ether 00:15:5d:64:0c:62 brd ff:ff:ff:ff:ff:ff

[root@Synoptics tmp]# host 103.230.84.24
Host 24.84.230.103.in-addr.arpa. not found: 3(NXDOMAIN)

After removing "103.230.84.24 Synoptics" from /etc/hosts
[root@Synoptics tmp]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: httpd: apr_sockaddr_info_get() failed for Synoptics
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[ OK ]

Re: Unable to download PDF/PNG/JPG Reports

Posted: Wed Jul 05, 2017 11:07 am
by tgriep
The output from the ip addr command shows a different IP address that your screen shots from your earlier posts.
Is the IP address of the Nagios server 10.230.84.24 or is it 10.245.44.98?